Esempio n. 1
0
 public function del_menu($appid, $appsecret)
 {
     $arr = $this->get_access_token($appid, $appsecret);
     if ($arr['access_token']) {
         $ACCESS_TOKEN = $arr['access_token'];
         $url = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" . $ACCESS_TOKEN;
         $arr = curl_https($url);
         //$arr = json_decode(file_get_contents($url),1);
         return $arr;
     } else {
         return $arr;
     }
 }
Esempio n. 2
0
function Login($user, $pwd)
{
    $url = 'https://app5.plateno.com:9951/authority/login';
    $data = '{"sign":"0d721cf76c3b9615e652e9f6122d60d5","username":"******","clientInfo":{"appVersion":"5.0.4","channelId":"262810","deviceId":"00000000-650a-e532-0d38-091f4bb985a8","hardwareModel":"m1 note","os":"android","systemVersion":"4.4.4","versionCode":"201520601"},"password":"******"}';
    $response = curl_https($url, $data, 20, null, FALSE);
    // echo $response;
    $temp1 = json_decode($response, true);
    if ($temp1['msgCode'] == 100) {
        // echo "<br>aaaaaaaaaaaaaaaaaa<br>";
        $id = $temp1['result']['member']['memberId'];
        $realname = $temp1['result']['member']['memberName'];
        $token = $temp1['result']['token'];
        $userlevel = $temp1['result']['member']['memberTypeName'];
        mysql_query("update user set id='{$id}' , realname='{$realname}' , userlevel='{$userlevel}' where username='******'");
        // echo "<br>登陆成功";
        // echo "<br>".$token;
        $reult['token'] = $token;
        $reult['user'] = $user;
        return $reult;
    } else {
        // echo "<br>123123123123123123132<br>";
        mysql_query("update user set info='fail' ,failnum=failnum+1 where username='******'");
    }
}
Esempio n. 3
0
 * @param Array  $header     请求时发送的header
 * @param int    $timeout    超时时间,默认30s
 */
function curl_https($url, $data = array(), $header = array(), $timeout = 30)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    // 跳过证书检查
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
    // 从证书中检查SSL加密算法是否存在
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    //    curl_setopt($ch, CURLOPT_POST, true);
    //    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
    $response = curl_exec($ch);
    if ($error = curl_error($ch)) {
        die($error);
    }
    curl_close($ch);
    return $response;
}
// 调用
$url = "https://www.taobao.com/";
//$url = "http://club.topsage.com";
//$data = array('name'=>'fdipzone');
$data = array();
$header = array();
$response = curl_https($url, $data, $header, 5);
echo $response;
Esempio n. 4
0
<?php

include_once './common.php';
$xxx = curl_https("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx659ecc805f987bac&secret=da3bb34cc373fd0c4921b414c08eddef", true);
var_dump($xxx);
exit;
$xxx = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx659ecc805f987bac&secret=da3bb34cc373fd0c4921b414c08eddef");
var_dump($xxx);
exit;
$h = getstr($_GET['h']);
$hash = substr($h, 0, 7);
$email = $_SGLOBAL['db']->getone("select email from " . tname("open_email_reg") . " where hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "' and used=0");
include_once './source/function_user.php';
if (is_email($email)) {
    $query = $_SGLOBAL['db']->query("SELECT uid,username,state FROM " . tname("open_member") . " where email='" . $email . "'");
    $user = $_SGLOBAL['db']->fetch_array($query);
    if ($user) {
        updatetable(tname('open_member'), array('email_valid' => 1), array('uid' => $user['uid']));
        $backurl = $_SGLOBAL['db']->getone("select backurl from " . tname("open_email_reg") . " where hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "'");
        $backurl = empty($backurl) ? 'user.php' : $backurl;
        $setarr = array('uid' => $user["uid"], 'username' => addslashes($user['username']), 'password' => md5($user["uid"] . "|" . $_SGLOBAL["timestamp"]));
        //清理更新在线session
        insertsession($setarr);
        $cookietime = 0;
        $cookietime = 3600 * 24 * 15;
        //设置cookie
        ssetcookie('auth', authcode($setarr["password"] . ' ' . $setarr["uid"], 'ENCODE'), $cookietime);
        ssetcookie('loginuser', $user['username'], $cookietime);
        ssetcookie('_refer', '');
        //标记这个登录码使用次数
        $used = $_SGLOBAL['db']->getone("select used from " . tname("open_email_reg") . " where email='" . $email . "' and hash='" . $hash . "' and addtime>'" . ($_SGLOBAL['timestamp'] - 24 * 3600) . "'");