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; } }
$strPageTitle = 'oauth登录-' . $_K['html_title']; $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');
<?php defined('IN_KEKE') or exit('Access Denied'); $uid and header("location:index.php"); $strPageTitle = '找回密码' . '- ' . $_K['html_title']; $arrStep = array('step1', 'step2'); in_array($strStep, $arrStep) or $strStep = 'step1'; $arrApiName = keke_glob_class::get_open_api(); $strUrl = $_K['siteurl'] . '/index.php?do=retrieve&strStep=step1'; switch ($strStep) { case "step1": if (kekezu::submitcheck($formhash)) { if (strtolower(CHARSET) == 'gbk') { $account = kekezu::utftogbk($account); } $user_login_obj = new keke_user_login_class(); $user_login_obj->account_init($account); $accout_type = $user_login_obj->get_login_type(); switch ($accout_type) { case 'mobile': $tips['errors']['account'] = '账号不存在'; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); break; case 'email': $arrUserInfo = keke_user_class::getUserInfoByEmail($account); break; case 'username': $arrUserInfo = keke_user_class::getUserInfoByUsername($account); break; } if (!$arrUserInfo) {
$strPageDescription = $kekezu->_sys_config['index_seo_desc']; if ($ac == 'checkname') { $strNameCheck = keke_user_class::check_username($account); if ($strNameCheck != 1) { kekezu::show_msg($strNameCheck, NULL, NULL, NULL, 'error'); } else { kekezu::show_msg("用户名可用", NULL, NULL, NULL, 'ok'); } } $arrOauthInfo = $_SESSION[$type . '_oauthInfo']; $memberOauthInfo = $arrOauthInfo; if (strtoupper(CHARSET) == 'GBK') { $arrOauthInfo = kekezu::utftogbk($arrOauthInfo); } $objReg = new keke_register_class(); $objLogin = new keke_user_login_class(); $arrBindInfo = keke_register_class::is_oauth_bind($type, $arrOauthInfo['account']); $account = $arrBindInfo['username']; if ($_SESSION[$type . '_oauthInfo'] && $arrBindInfo && !$to_bind) { $_SESSION[$type . '_oauthInfo'] = null; setcookie($type . 'uid', 1, time() - 1); $arrUserInfo = kekezu::get_user_info($arrBindInfo['uid']); $loginUserInfo = $objLogin->oauth_user_login($arrUserInfo['username'], $arrUserInfo['password'], null, 1); $objLogin->save_user_info($loginUserInfo, 1); } elseif ($_SESSION[$type . '_oauthInfo'] && !$arrBindInfo && !$formhash && !$to_bind) { $password = kekezu::randomkeys(6); $account = kekezu::escape($arrOauthInfo['nickname']); $is_nameExist = 1; while ($is_nameExist) { $hasUser = db_factory::get_one("select * from " . TABLEPRE . "witkey_space where username='******'"); if ($hasUser) {
$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'); } } isset($hdn_refer) and $_K['refer'] = $hdn_refer; isset($_COOKIE['kekeloginrefer']) and $_K['refer'] = $_COOKIE['kekeloginrefer']; $refer_do = array('do' => null); $refer = parse_url($_K['refer']); isset($refer['query']) and parse_str($refer['query'], $refer_do); !$refer_do['do'] && ($do = 'logout') and $refer_do['do'] = 'logout'; in_array($refer_do['do'], array('logout', 'register', 'login', 'activating')) and $_K['refer'] = 'index.php' or $_K['refer'] = $_K['refer']; $strCode = isset($code) ? $code : ""; $intLoginType = isset($login_type) ? $login_type : ""; $ckb_cookie = isset($ckb_cookie) ? $ckb_cookie : ""; if (strtoupper(CHARSET) == 'GBK') { $account = kekezu::utftogbk($account); } $account = kekezu::escape($account); $objLogin = new keke_user_login_class(); $arrUserInfo = $objLogin->user_login($account, kekezu::escape($password), $strCode, $intLogin_type); db_factory::execute("update " . TABLEPRE . "witkey_space set is_mail=0 where uid=" . $arrUserInfo[uid]); $objLogin->save_user_info($arrUserInfo, $account, $ckb_cookie, $intLoginType, intval($autoLogin)); die; } $_SESSION['spread'] = 'index.php?do=login';