function login($call_back, $url) { global $oauth_verifier, $code, $_K; if (isset($code) && $this->_wb_type == 'sina') { $oauth_verifier = array('code' => $code, 'redirect_uri' => $url); } if ($call_back) { if (isset($code) && $this->_wb_type == 'sina') { if ($oauth_verifier) { oauth_api_factory::create_access_token($oauth_verifier, $this->_wb_type, $this->_app_id, $this->_app_secret); $oauth_user_info = $this->get_login_user_info(); $bind_info = keke_register_class::is_oauth_bind($this->_wb_type, $oauth_user_info['account']); if ($oauth_user_info && $bind_info) { $user_info = kekezu::get_user_info($bind_info['uid']); $login_obj = new keke_user_login_class(); $login_user_info = $login_obj->user_login($user_info['username'], $user_info['password'], null, 1); $login_obj->save_user_info($login_user_info, 1); } else { $_SESSION['wb_type'] = $this->_wb_type; header("Location:{$_K['siteurl']}/index.php?do=index"); die; } } else { header("Location:{$_K['siteurl']}/index.php?do=login"); die; } } else { oauth_api_factory::create_access_token($oauth_verifier, $this->_wb_type, $this->_app_id, $this->_app_secret); $oauth_user_info = $this->get_login_user_info(); $bind_info = keke_register_class::is_oauth_bind($this->_wb_type, $oauth_user_info['account']); if ($oauth_user_info && $bind_info) { $user_info = kekezu::get_user_info($bind_info['uid']); $login_obj = new keke_user_login_class(); $login_user_info = $login_obj->user_login($user_info['username'], $user_info['password'], null, 1); $login_obj->save_user_info($login_user_info, 1); } else { $_SESSION['wb_type'] = $this->_wb_type; header("Location:{$_K['siteurl']}/index.php?do=index"); die; } } } $this->_url = $url; if (oauth_api_factory::get_access_token($this->_wb_type, $this->_app_id, $this->_app_secret)) { return true; } else { $aurl = oauth_api_factory::get_auth_url("{$url}&call_back=1", $this->_wb_type, $this->_app_id, $this->_app_secret); header('Location:' . $aurl); die; } }
$strPageKeyword = 'oauth登录,' . $_K['html_title']; $strPageDescription = $kekezu->_sys_config['index_seo_desc']; $type = strval(trim($type)); $arrOauthType = UserCenter::getOauthType(); if (!$_SESSION[$type . '_oauthInfo']) { if (in_array($type, array_keys($arrOauthType))) { UserCenter::oauthRoute($type); } kekezu::show_msg('缺少参数', 'index.php?do=login', 3, NULL, 'warning'); } $arrOauthInfo = $_SESSION[$type . '_oauthInfo']; if (strtoupper(CHARSET) == 'GBK') { $arrOauthInfo = kekezu::utftogbk($arrOauthInfo); } $objLogin = new keke_user_login_class(); $arrBindInfo = keke_register_class::is_oauth_bind($type, $arrOauthInfo['account']); if ($_SESSION[$type . '_oauthInfo'] && $arrBindInfo && !$is_binding) { $_SESSION[$type . '_oauthInfo'] = null; $arrUserInfo = kekezu::get_user_info($arrBindInfo['uid']); $loginUserInfo = $objLogin->oauth_user_login($arrUserInfo['username'], $arrUserInfo['password'], null, 1); $objLogin->save_user_info($loginUserInfo, 1); } $inter = $kekezu->_sys_config['user_intergration']; $intLoginTimes = intval($_SESSION['login_times']); if (kekezu::submitcheck(isset($formhash)) || isset($login_type) == 3) { if ($code) { $strCodeCheck = kekezu::check_secode($code); if ($strCodeCheck != 1) { $tips['errors']['code'] = $strCodeCheck; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); }