-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqqcallback.php
40 lines (36 loc) · 979 Bytes
/
qqcallback.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Created by PhpStorm.
* User: koastal
* Date: 2016/7/15
* Time: 15:20
* QQ登陆回调页面
*/
require_once("QQAPI/qqConnectAPI.php");
require_once('config.php');
require_once('curl.php');
require_once('saeMySQL.php');
header("Content-type:text/html;charset=utf-8");
$param = array();
$qc = new QC();
$res = $qc->qq_callback();
$param['access_token'] = $res['access_token'];
$res = $qc->get_openid();
$openid = $res->openid;
$param['openid'] = $openid;
$param['appid'] = $qc->get_appid();
$mysql = new saeMySQL();
$sql = "SELECT * FROM user WHERE qq='$openid'";
$query = $mysql->query($sql);
$res = $query->fetch_assoc();
if($res){
//登入本地账户
$_SESSION['uid'] = $res['id'];
$_SESSION['username'] = $res['username'];
$_SESSION['token'] = md5($_SESSION['uid'].$_SESSION['username']);
header("Location:index.php");
}else{
echo "$openid<hr/>微博账户尚未绑定本地用户。";
}
?>
<p><a href="logout.php">logout</a></p>