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; } }
function user_intergration($username, $pwd) { global $_lang; if ($this->_sys_config['user_intergration'] == 2) { require_once S_ROOT . '/uc_client/client.php'; $uc_info = uc_user_login($username, $pwd); if ($uc_info['0'] > 0) { $u = array('uid' => $uc_info['0'], 'username' => $uc_info['1'], 'email' => $uc_info['3']); } else { $u = $uc_info['0']; } } if ($u == -2) { $this->show_msg($_lang['you_input_password_not_right'], 3); } elseif ($u == -1) { $this->show_msg($_lang['you_input_username_not_exist'], 4); } else { $exists = db_factory::get_count(sprintf(" select uid from %switkey_member where uid='%d' ", TABLEPRE, $u['uid'])); if (!$exists) { $reg_obj = new keke_register_class(); $reg_obj->_reg_pwd = md5($pwd); $reg_obj->save_userinfo($u['username'], $u['email'], $u['uid']); } } return $u; }
$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 $uid && !isset($_SESSION['auid']) and header("location:index.php"); $strPageTitle = '注册-' . $_K['html_title']; $strPageKeyword = '注册,' . $_K['html_title']; $strPageDescription = $kekezu->_sys_config['index_seo_desc']; $objReg = new keke_register_class(); $arrApiNames = keke_glob_class::get_open_api(); if (isset($formhash) && kekezu::submitcheck($formhash)) { //检测身份 if (intval($reg_user_type) != 1 && intval($reg_user_type) != 2) { $tips['errors']['reg_user_type'] = '请选择需方或供方身份注册'; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); } //检测需方身份 if (intval($reg_user_type) == '1') { if (intval($reg_user_type_xf) != 1 && intval($reg_user_type_xf) != 2) { $tips['errors']['reg_user_type_xf'] = '请选择个人用户或者企业用户'; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); } } elseif (intval($reg_user_type) == '2') { $reg_user_type_xf = 2; //供方都是企业认证 } if (keke_user_class::user_checkemail($email) != 1) { $tips['errors']['email'] = '该email非法或已经被注册'; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); } if (strtoupper(CHARSET) == 'GBK') { $account = kekezu::utftogbk($account); }
kekezu::admin_show_msg($_lang['operate_notice'], "index.php?do=user&view=add", 3, $_lang['user_creat_success'], 'success'); } else { $uinfo = kekezu::get_user_info($edituid); if ($fds['password']) { $slt = db_factory::get_count(sprintf("select rand_code from %switkey_member where uid = '%d'", TABLEPRE, $edituid)); $sec_code = keke_user_class::get_password($fds['password'], $slt); $fds['sec_code'] = $sec_code; $newpwd = $fds['password']; $pwd = md5($fds['password']); $fds[password] = $pwd; db_factory::execute(sprintf("update %switkey_member set password ='******' where uid=%d", TABLEPRE, $pwd, $edituid)); } else { unset($fds['password']); } keke_user_class::user_edit($uinfo['username'], '', $newpwd, '', 1); $space_class->save($fds, array("uid" => "{$edituid}")); kekezu::admin_system_log($_lang['edit_member'] . $member_arr[username]); kekezu::admin_show_msg($_lang['edit_success'], "index.php?do=user&view=add&edituid=" . $edituid, 3, '', 'success'); } } if ($check_email) { $regClass = new keke_register_class(); $result = $regClass->check_email($check_email); if ($result !== true) { echo $result; } else { echo 1; } die; } require $template_obj->template(ADMIN_DIRECTORY . '/tpl/admin_user_add');
$strPageKeyword = 'oauth注册,' . $_K['html_title']; $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='******'");