Exemplo n.º 1
0
if ($isWechat) {
    require __DIR__ . '/../../vendor/pingplusplus/pingpp-php/init.php';
    $appId = '******************';
    $appSecret = '********************************';
    $currentUrl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
    if (!isset($_GET['code'])) {
        $url = \Pingpp\WxpubOAuth::createOauthUrlForCode($appId, $currentUrl);
        header('Location: ' . $url);
        exit;
    } else {
        if (session_status() != PHP_SESSION_ACTIVE) {
            @session_start();
        }
        if (!isset($_SESSION['wechatOpenid'])) {
            $code = $_GET['code'];
            $_SESSION['wechatOpenid'] = \Pingpp\WxpubOAuth::getOpenid($appId, $appSecret, $code);
        }
    }
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <meta name="author" content="Cosmo">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
    <title>笑e购</title>
Exemplo n.º 2
0
//    echo $url;
//    echo $callback_url;
    header("Location:" . $url);
    exit();
}

//判定推广
$state = 'arr+Main';
if (isset($_GET['state'])) {
    $state = $_GET['state'];
} else {

}

//获取open_id
$openid = \Pingpp\WxpubOAuth::getOpenid($MY_APP_KEY, $MY_APP_SECRET, $code);
echo $openid.'<br>';
//echo "<a href=\"payticket.php?name=陈佳&phone=13489092003&address=济南&kind=1&openid=$openid&state=arr+fashioncj\">购票</a>";

//查询余票&&清除锁定

$nowitme = time() - (45 * 60);
$nowitme = date("Y-m-d H:i:s", $nowitme);
$sql = "UPDATE ticket SET state=0 WHERE state=1 AND locktime<'{$nowitme}'";
$query = mysqli_query($con, $sql);
if ($query) {
    $sql = "select kind,count(state) from ticket where state=0 group by kind order by kind";
    $query=mysqli_query($con,$sql);
    while($row=mysqli_fetch_array($query)){
        echo $row['kind'] . " " . $row['count(state)'];
        echo "<br />";