<?php require_once "../includes/conn.php"; require_once "../includes/wxtoken.php"; $tools = new tools(); if (!$tools->check_is_weixin()) { header("Location:guanzhu.php"); exit; } $sysconfig = $dbconn->fetch($dbconn->query("select * from " . DBQIAN . "sys_config order by id desc limit 1")); $hongbaorow = $dbconn->fetch($dbconn->query("select * from " . DBQIAN . "xianjin_set order by id desc limit 1")); define('APPID', $sysconfig['cappid']); define('APPSECRET', $sysconfig['cappsecret']); $wxtoken = new wxtoken(); $signPackage = $wxtoken->GetSignPackage(); $utcode = isset($_GET['utcode']) && $_GET['utcode'] != '' ? $_GET['utcode'] : ''; //获取用户的openid if (isset($_GET['code']) && $_GET['code'] != '') { $WXCODE = $_GET['code']; $getucodeurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . APPID . "&secret=" . APPSECRET . "&code=" . $WXCODE . "&grant_type=authorization_code"; $getucodejson = json_decode($tools->http_curl_get($getucodeurl, true)); $ucode = $getucodejson->openid; //自己的ucode if ($ucode == '') { header("Location:index.php?utcode=" . $utcode . "&sk=" . $_GET['sk'] . "&sh=" . $_GET['sh']); exit; } $usernum = $dbconn->countn(DBQIAN . "user_list", " ucode='{$ucode}' "); $access_token = $wxtoken->getAccessToken(); $geturl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $ucode . "&lang=zh_CN"; $getutxtjson = json_decode($tools->http_curl_get($geturl, true));
<?php session_start(); include "../includes/conn.php"; include "../includes/wxtoken.php"; $dbconn->admin_logincheck(); $adminid = $_SESSION['adminid']; $tools = new tools(); $wxtoken = new wxtoken($adminid); $access_token = $wxtoken->getAccessToken(); $dataStart = "{\r\n \"button\":["; $dataEnd = "]\r\n }"; $dataContent = ""; $i = 1; $zhunum = $dbconn->countn(DBQIAN . "caidan_list", " adminid={$adminid} and cid=0"); $query = $dbconn->query("select * from " . DBQIAN . "caidan_list where adminid={$adminid} and cid=0 order by cnum desc,id desc "); while ($row = $dbconn->fetch($query)) { $num = $dbconn->countn(DBQIAN . "caidan_list", " cid={$row['id']} "); if ($num == 0) { if ($row['ctype'] == 0) { $menus = "{\r\n\t\t\t \"type\":\"view\",\r\n\t\t\t \"name\":\"" . iconv("GBK", "UTF-8", $row['cname']) . "\",\r\n\t\t\t \"url\":\"" . iconv("GBK", "UTF-8", $row['curl']) . "\"\r\n\t\t\t }"; } else { $menus = "{ \r\n\t\t \"type\":\"click\",\r\n\t\t\t \"name\":\"" . iconv("GBK", "UTF-8", $row['cname']) . "\",\r\n\t\t\t \"key\":\"" . iconv("GBK", "UTF-8", $row['ckey']) . "\"\r\n\t\t\t }"; } if ($i < $zhunum) { $menus = $menus . ','; } $dataContent = $dataContent . $menus; } else { $j = 1; $mquery = $dbconn->query("select * from " . DBQIAN . "caidan_list where adminid={$adminid} and cid={$row['id']} order by cnum desc,id desc ");
require_once "../includes/wxtoken.php"; $tools = new tools(); $sk = intval($_GET['sk']); $sh = intval($_GET['sh']); $utcode = $_GET['utcode']; $nowtime = time(); if ($sk > 0 && $sh > 0) { $chash = (int) (($nowtime - $sk) / 3600); if ($chash >= $sh) { exit; } } if ($sk == 0 || $sh == 0) { exit; } $wxtoken = new wxtoken(); $signPackage = $wxtoken->GetSignPackage(); $hongbaorow = $dbconn->fetch($dbconn->query("select hfaci,hlingqu,hjinzhiqu,hfentitle,htime,hfenimg,hfendes from " . DBQIAN . "xianjin_set limit 1")); if ($hongbaorow['hlingqu'] != "" || $hongbaorow['hjinzhiqu'] != "") { $uip = $tools->get_ip(); $res1 = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=" . $uip); $res1 = json_decode($res1); $uipdizhi = ''; $uipdizhi = $uipdizhi . iconv("UTF-8", "GBK", $res1->data->country); $uipdizhi = $uipdizhi . iconv("UTF-8", "GBK", $res1->data->region); $uipdizhi = $uipdizhi . iconv("UTF-8", "GBK", $res1->data->city); $uipdizhi = $uipdizhi . iconv("UTF-8", "GBK", $res1->data->isp); if ($hongbaorow['hlingqu'] != "") { $diqu = @explode(",", $hongbaorow['hlingqu']); $lingcode = 0; foreach ($diqu as $val) {