function qq_login_get_user_by_openid($openid, $token, $appid)
{
    $get_user_info_url = "https://graph.qq.com/user/get_user_info?access_token={$token}&oauth_consumer_key={$appid}&openid={$openid}&format=json";
    $s = https_get($get_user_info_url);
    $arr = json_decode($s, true);
    return $arr;
}
Example #2
0
        die('FAILTURE');
    }
    $orderId = $param["exorderno"];
    //updat redis
    $redis = new RedisHelper($config);
    $data = $redis->HGet("recharge_order", $orderId);
    if ($data === false) {
        error_log(FormatLogStr('lenovo', 'callback', ERROR_NEXIST, "order : {$orderId} is not exist"));
        die('FAILTURE');
    }
    $cache = json_decode($data, true);
    $cache["ExtOrderId"] = $param["transid"];
    $cache['PayTime'] = strtotime($param["transtime"]);
    $cache['Uin'] = intval($param["cpprivate"]);
    $url = $config['center'] . $centerPath . '?uin=' . $param["cpprivate"] . '&orderId=' . $orderId . "&shopId=" . $shopid;
    $res = https_get($url);
    if ($res === 'callback success') {
        error_log(FormatLogStr('lenovo', 'callback', ERROR_0, $transdata . "&sign={$sign}"));
        $log = GetLogger($config['logger']);
        $log->writeFile(FormatLogStr('lenovo', 'callback', ERROR_0, $url . ' ExtOrderId : ' . $cache['ExtOrderId']));
        $cache["Status"] = "success";
        $redis->HSet("recharge_order", $orderId, $cache);
        die('SUCCESS');
    } else {
        $redis->HSet("recharge_order", $orderId, $cache);
        error_log(FormatLogStr('lenovo', 'callback', ERROR_CENTER, $url));
        die('FAILTURE');
    }
} else {
    error_log(FormatLogStr('lenovo', 'callback', ERROR_SIGN, $transdata . "&sign={$sign}"));
    die('FAILTURE');
Example #3
0
function http_multi_get($urls)
{
    // 如果不支持,则转为单线程顺序抓取
    if (!function_exists('curl_multi_init')) {
        $data = array();
        foreach ($urls as $k => $url) {
            $data[$k] = https_get($url);
        }
        return $data;
    }
    $multi_handle = curl_multi_init();
    foreach ($urls as $i => $url) {
        $conn[$i] = curl_init($url);
        curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1);
        $timeout = 3;
        curl_setopt($conn[$i], CURLOPT_CONNECTTIMEOUT, $timeout);
        // 超时 seconds
        curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
        //curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
        curl_multi_add_handle($multi_handle, $conn[$i]);
    }
    do {
        $mrc = curl_multi_exec($multi_handle, $active);
    } while ($mrc == CURLM_CALL_MULTI_PERFORM);
    while ($active and $mrc == CURLM_OK) {
        if (curl_multi_select($multi_handle) != -1) {
            do {
                $mrc = curl_multi_exec($multi_handle, $active);
            } while ($mrc == CURLM_CALL_MULTI_PERFORM);
        }
    }
    foreach ($urls as $i => $url) {
        $data[$i] = curl_multi_getcontent($conn[$i]);
        curl_multi_remove_handle($multi_handle, $conn[$i]);
        curl_close($conn[$i]);
    }
    return $data;
}
    echo "没有输入长度";
    return;
}
if (!$_GET["reward"]) {
    echo "没有输入奖励";
    return;
}
$server_ip = $_GET["server_ip"];
$server_port = $_GET["server_port"];
$name = $_GET["name"];
$type = $_GET["type"];
$count = $_GET["count"];
$length = $_GET["length"];
$reward = $_GET["reward"];
$reward_type = $_GET["reward_type"];
$url = "http://" . $server_ip . ":" . $server_port . "/cdk/genKey?";
$url = $url . "count=" . $count . "&length=" . $length . "&type=" . $type . "&reward=" . $reward . "&reward_type=" . $reward_type;
$url = $url . "&name=" . $name . "&platform=0";
$ret = https_get($url, 40);
if (!$ret) {
    echo "连接失败";
}
$ret_obg = json_decode($ret, true);
if ($ret_obg["status"] == 0) {
    echo "<h1>生成成功</h1>";
    $cdks = $ret_obg["cdks"];
    $cdks_arr = explode(",", $cdks);
    foreach ($cdks_arr as $value) {
        echo "<div>" . $value . "</div>";
    }
}
require_once dirname(__FILE__) . "/../title.php";
require_once dirname(__FILE__) . "/../util.php";
if (!$_GET["server_ip"]) {
    echo "没有输入服务器ip";
    return;
}
if (!$_GET["server_port"]) {
    echo "没有输入服务器端口";
    return;
}
if (!$_GET["uin"]) {
    echo "没有输入玩家uin";
    return;
}
if (!$_GET["level"]) {
    echo "没有输入等级";
    return;
}
if (!$_GET["exp"]) {
    echo "没有输入经验";
    return;
}
$server_ip = $_GET["server_ip"];
$server_port = $_GET["server_port"];
$uin = $_GET["uin"];
$level = $_GET["level"];
$exp = $_GET["exp"];
$url = "http://" . $server_ip . ":" . $server_port . "/gm?";
$url = $url . "gmtype=changelevel&uin=" . $uin . "&level=" . $level . "&exp=" . $exp;
echo https_get($url);
Example #6
0
        return true;
    }
    return false;
}
$method = $_SERVER['REQUEST_METHOD'];
$data = array();
if ($method == "GET") {
    $data = $_GET;
} elseif ($method == "POST") {
    $data = $_POST;
} else {
    error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'invalidate request method : ' . $method));
    die('false');
}
if (empty($data['sign'])) {
    //没有发现签名数据
    error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'not found sign param with param ' . json_encode($data)));
    die('false');
}
//得到请求中的sign
$sign = $data['sign'];
//去除sign字段
unset($data['sign']);
//得到请求参数
$str = getDataStr($data);
if (verify($str, $sign, $pubKey)) {
    echo https_get($gmaddr . '?' . $str);
} else {
    error_log(FormatLogStr('gm', 'magic.php', ERROR_0, 'verify sign failed with param ' . $str . " with sign : {$sign}"));
    echo 'false';
}