Exemple #1
0
<?php

require_once "filter.php";
require_once "shake2.php";
$shake = new Shake();
$uid = $_COOKIE[USER_COOKIE_ID];
//$config['redirect_uri'] = 'http://www.hx028.net/weixin-shake/xiangjiang2.0/callback.php';
$url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $config["appid"] . '&redirect_uri=' . htmlspecialchars($config["redirect_uri"]) . '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
if ($uid) {
    $user = $shake->getUser($uid, $config['appid']);
    if (!$user || $user['expiretime'] < time()) {
        //用户不存在或者过期
        header("Location:" . $url);
        exit;
    }
} else {
    header("Location:" . $url);
    exit;
}
//判断活动是否开始
date_default_timezone_set('Asia/Shanghai');
$current_time = time();
$current_day = intval(date("d", $current_time));
$current_hour = intval(date("H", $current_time));
$current_month = intval(date("m", $current_time));
$has_start = true;
if (8 != $current_month) {
    $has_start = false;
}
if (!in_array($current_day, array(1, 2, 3, 5))) {
    $has_start = false;