http . '://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]); // print_r($tourl);exit(); $ccc=I(); // print_r('测试Login_session'.$_SESSION); // print_r('测试ccc'.$ccc); if (strpos($_SERVER['HTTP_USER_AGENT'], "MicroMessenger") != false) { $visitors = I('get.act'); if ($visitors == 'visitors') { //echo $visitors; } else { if (!session('idopenid')) { $code = I('get.code'); if (empty($code)) { $tourl = urlencode($this -> http . '://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]); // header('Location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . C('APPID') . '&redirect_uri=' . $tourl . '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect '); header('Location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx41e478e592f9e04a&redirect_uri=' . $tourl . '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect '); } else { // $user_openid = $this -> s_curl('https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . C('APPID') . '&secret=' . C('SECRET') . '&code=' . $code . '&grant_type=authorization_code'); $user_openid = $this -> s_curl('https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx41e478e592f9e04a&secret=fc165de4aa5cd24b628baa30b100e146&code=' . $code . '&grant_type=authorization_code'); $res = M() -> query("SELECT idphone FROM sp_wx_customuser WHERE openid='" . $user_openid['openid'] . "'"); session('idopenid', $user_openid['openid']); if (count($res) > 0) { header("Location: " . $this -> http . "://" . $_SERVER['SERVER_NAME'] . "/jdxf/wxapp2.php/Home/Index/index"); } } } } } else{ $curl_token = $this -> s_curl2($this -> http . '://iot.usky.cn/jdxf/wxapp.php?key=38fff9e882bb58973942a16bb5bb05d005ad08d1e&secret=54cf9b2eb141284fb3974d8433e28293'); // $curl_token = $this -> s_curl2($this -> http . '://' . $_SERVER['SERVER_NAME'] . '/jdxf/wxapp.php?key=38fff9e882bb58973942a16bb5bb05d005ad08d1e&secret=54cf9b2eb141284fb3974d8433e28293'); // print_r('https://'. $_SERVER['SERVER_NAME'] . '/jdxf/wxapp2.php?key=38fff9e882bb58973942a16bb5bb05d005ad08d1e&secret=54cf9b2eb141284fb3974d8433e28293'); // $a=json_decode($curl_token,true); // $curl_token = htmlspecialchars_decode($curl_token); $a =(array)json_decode($curl_token,true); // echo $errorinfo = json_last_error(); // var_dump($curl_token); // var_dump($a); // print_r($arr); $this -> token = $a['val']; // // print_r($this -> token); } } public function index() { $this -> display('Index/User_register'); } public function add() {//保存用户并发送通知 $Data = I(''); $User = M('wx_customuser'); $phone = $Data['phone']; $re['code'] = 'falied'; $Message = '验证码无效,请重新获取!'; $Arr = explode(",", session('jdverify')); $verifyTime = floor(strtotime(date('Y-m-d H:i:s'))) - floor(strtotime($Arr[1])); //if ($verifyTime < 290 ||$phone == '15601615640' || $phone == '15000011254') { $Message = '验证码错误,请重新填写!'; //$Arr[0] //if ($Data['verify'] == $Arr[0] || $phone == '15601615640' || $phone == '15000011254') if(($Data['verify'] == '995862') ||($Data['verify'] == $Arr[0] )) { $Message = '验证成功,登录失败,请联系管理员------'; session('jdverify', null); $Data['createtime'] = date('Y-m-d H:i:s'); $Data['idphone'] = $phone; if (!empty($this -> token)) { $Data['openid'] = $this -> token; $Data['type'] = 'app'; } else { $Data['openid'] = session('idopenid'); $Data['type'] = 'wx'; } $Res = $User -> add($Data); // $Id = $User->getLastInsID(); $re['jdverifys'] = ''; if ($Res) { $Message = '验证成功,正在登录,请等待跳转------'; session('idphone', $phone); session('idtoken', $this -> token); $re['code'] = 'success'; if (!empty($this -> token)) { M() -> execute("DELETE FROM sp_wx_customuser where openid!='" . $this -> token . "' and type='app' and idphone='" . $phone . "'"); $re['jdverifys'] = $this -> token; $re['phone'] = $phone; } } /*}*/ } } $re['mesg'] = $Message; echo json_encode($re); } public function appindex(){ $Data = I(''); $User = M('wx_customuser'); if (!empty($Data['phone'])){ $res = M() -> query("SELECT idphone FROM sp_wx_customuser WHERE idphone='" . $Data['phone'] . "' and type='app'"); if (!empty($res)){ header("Location:https://qhome.usky.cn/jdxf/wxapp2.php/Home/Index/index/token/".$res[0]['openid']); } //; if(!empty($res)){ // session('idphone', $Data['phone']); // session('idtoken', $this -> token); // } // $re['jdverifys'] = ''; // if ($Res) { // $Message = '验证成功,正在登录,请等待跳转------'; // session('idphone', $Data['phone']); // session('idtoken', $this -> token); // $re['code'] = 'success'; // if (!empty($this -> token)) { // M() -> execute("DELETE FROM sp_wx_customuser where openid!='" . $this -> token . "' and type='app' and idphone='" . $Data['phone'] . "'"); // $re['jdverifys'] = $this -> token; // $re['phone'] = $Data['phone']; // } // $re['mesg'] = $Message; // echo json_encode($re); // } }else{ } } public function checkVerify() {//发送短信验证码 include ('/php/api_sdk/JdMessageSend2.php'); $Data = I('tel'); $Verx = rand('10000', '99999'); session('jdverify', $Verx . ',' . date('Y-m-d H:i:s')); sendSms("$Data", "$Verx"); } public function checkVs() { $Data = I(''); $resc = M() -> query('select phone from sp_wx_customuser where openid="' . $Data['datav'] . '"'); $re['code'] = 'falied'; if (!empty($resc)) { session('idphone', $resc[0]['phone']); session('idtoken', $Data['datav']); $re['code'] = 'success'; } echo json_encode($re); } private function s_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $file_contents = curl_exec($ch); curl_close($ch); $arr = json_decode($file_contents, true); // var_dump($arr); return $arr; } private function s_curl2($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $file_contents = curl_exec($ch); curl_close($ch); // $arr = json_decode($file_contents, true); // var_dump($arr); return $file_contents; } // semi : 访客二维码 // oddtional public function visitors() { $date_time = date("Y-m-d H:i:s"); $period = "2018-06-14"; $period_start = $period." 00:00:00"; $period_end = $period." 23:59:59"; if ($date_time > $period_start && $date_time < $period_end) { if (strpos($_SERVER['HTTP_USER_AGENT'], "MicroMessenger") != false) { //session('idopenid111','o83OY1VRdn931Gbn4yH7630vzoRo'); $phone = '15000012454'; } else { session('idphone', '15000012454'); session('idtoken', '48299a584827014d890dc585cc2b80e2'); $phone = '15000012454'; } header("Location: " . $this -> http . "://" . $_SERVER['SERVER_NAME'] . "/jdxf/wxapp.php/Home/Index/index/user/" . $phone); } else { $html=<< *{font-family:consolas;} body{width:auto;margin:0px auto;text-align:center;font-size:38px;} @keyframes myfirst { 0% {color: #3fc3a6; left:-200px; } 35% {color: #343471; left:0px; } 65% {color: #343471; left:0px; } 100% {color: #3fc3a6; left:200px; } } h1{ position:relative; animation: myfirst 1s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-direction: alternate; margin:0 auto; } p{ width:100%;height:60px;line-height:60px; color:#ff6f6f; font-size:30px; } p.p1{ margin-top: -100px;font-size:14px; }

Usky

Time is expire!

( $period_start ~ $period_end )

EOF; s_print($html); } } }