|
|
ɳ

楼主 |
发表于 2018-6-7 16:10:04
|
只看该作者
第三方登陆--QQ登陆
/member/login.php?lang=cn&a=doother&type=qq
public function doother() {
global $_M;
$other = $this->other($_M['form']['type']);
$other->set_state();
$url = $other->get_login_url();
okinfo($url);
}
public function other($type) {
global $_M;
if(!$type){
okinfo($_M['url']['login'], $_M['word']['membererror4']);
}
if($type == 'qq'){
$other = load::mod_class('user/web/class/qq', 'new');
}
if($type == 'weibo'){
$other = load::mod_class('user/web/class/weibo', 'new');
}
if($type == 'weixin'){
$other = load::mod_class('user/web/class/weixin', 'new');
}
return $other;
}
public function set_state(){
load::sys_class('session', 'new')->set('other_state', random(10));
}
public function get_login_url(){
global $_M;
$redirect_uri = $_M['url']['site'].'member/login.php?a=doother_login&type=qq';
$url .= "https://graph.qq.com/oauth2.0/authorize?";
$url .= "client_id={$this->appid}";
$url .= "&redirect_uri=".urlencode($redirect_uri);
$url .= "&response_type=code";
$url .= "&scope=get_user_info";
$url .= "&state=".$this->get_state();
return $url;
}
|
|