Esempio n. 1
0
    try {
        $token = $o->getAccessToken('code', $keys);
    } catch (OAuthException $e) {
    }
}
if ($token) {
    $_SESSION['topsession'] = $token;
    setcookie('weibojs_' . $o->client_id, http_build_query($token));
    $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['topsession']['access_token']);
    $ms = $c->home_timeline();
    // done
    $uid_get = $c->get_uid();
    $uid = $uid_get['uid'];
    $user_message = $c->show_user_by_id($uid);
    //根据ID获取用户等基本信息
    $username = $user_message["name"];
    if (empty($username)) {
        redirect("Login.php?login_error=" . rawurlencode("error:" . $user_message["error"] . ",error_code:" . $user_message["error_code"]));
    }
    $_SESSION['nick'] = $user_message["name"];
    $userid = getUserIDByNick($username);
    if ($userid == 0) {
        $userid = InsertNickInfo($username, "weibo");
    }
    $_SESSION['authenticated_user_id'] = $userid;
    $_SESSION['app_unique_key'] = $application_unique_key;
    $_SESSION['authenticated_user_language'] = 'zh_cn';
    redirect("index.php");
} else {
    redirect("Login.php");
}
Esempio n. 2
0
if (empty($top_sign)) {
    header("Location: Login.php");
}
$appKey = $top_appkey;
$appSecret = "12a22f00e474ded4c59a6d0a5e0cee67";
$md5 = md5($top_appkey . $top_parameters . $top_session . $appSecret, true);
$sign = base64_encode($md5);
if ($sign != $top_sign) {
    echo "<script>alert(\"signature invalid.\");window.location.href=\"Login.php\"</script>";
    die;
}
$_SESSION['sign'] = $sign;
$parameters = array();
parse_str(base64_decode($top_parameters), $parameters);
/* $now = time();
$ts = $parameters['ts'] / 1000;    
if ( $ts > ( $now + 60 * 10 ) || $now > ( $ts + 60 * 30 ) ) {
	echo "<script>alert(\"request out of date.\");window.location.href=\"Login.php\"</script>";die;
} */
$_SESSION['topsession'] = $_REQUEST['top_session'];
$_SESSION['nick'] = iconv_ec("GBK", "UTF-8", $parameters['visitor_nick']);
$userid = getUserIDByNick($_SESSION['nick']);
if ($userid == 0) {
    $userid = InsertNickInfo($_SESSION['nick']);
}
$_SESSION['authenticated_user_id'] = $userid;
$_SESSION['app_unique_key'] = $application_unique_key;
$_SESSION['appKey'] = $appKey;
$_SESSION['appSecret'] = $appSecret;
$_SESSION['authenticated_user_language'] = 'zh_cn';
header("Location: main.php");
Esempio n. 3
0
if (empty($top_sign)) {
    header("Location: Login.php");
}
$appKey = $top_appkey;
$appSecret = "86a95918f231189563c9fceefe6e99cc";
$md5 = md5($top_appkey . $top_parameters . $top_session . $appSecret, true);
$sign = base64_encode($md5);
if ($sign != $top_sign) {
    echo "<script>alert(\"signature invalid.\");window.location.href=\"Login.php\"</script>";
    die;
}
$_SESSION['sign'] = $sign;
$parameters = array();
parse_str(base64_decode($top_parameters), $parameters);
/* $now = time();
$ts = $parameters['ts'] / 1000;    
if ( $ts > ( $now + 60 * 10 ) || $now > ( $ts + 60 * 30 ) ) {
	echo "<script>alert(\"request out of date.\");window.location.href=\"Login.php\"</script>";die;
} */
$_SESSION['topsession'] = $_REQUEST['top_session'];
$_SESSION['nick'] = iconv_ec("GBK", "UTF-8", $parameters['visitor_nick']);
$userid = getUserIDByNick($_SESSION['nick']);
if ($userid == 0) {
    $userid = InsertNickInfo($_SESSION['nick'], "taobao");
}
$_SESSION['authenticated_user_id'] = $userid;
$_SESSION['app_unique_key'] = $application_unique_key;
$_SESSION['appKey'] = $appKey;
$_SESSION['appSecret'] = $appSecret;
$_SESSION['authenticated_user_language'] = 'zh_cn';
header("Location: index.php");