function checkpass($username, $password, $safecv, $lgt = 0) { global $db_ifsafecv, $db_ifpwcache, $db, $timestamp, $onlineip; if (!checkLgt($lgt)) { //Showmsg('login_errortype'); return 'login_errortype'; } require_once R_P . 'uc_client/uc_client.php'; $uc_user = uc_user_login($username, $password, $lgt); if ($uc_user['status'] == -1) { $GLOBALS['errorname'] = $username; //Showmsg('user_not_exists'); return 'user_not_exists'; } if ($uc_user['status'] == -3) { //Showmsg('reg_email_have_same'); return 'reg_email_have_same'; } if (!($men = getLoginUser($uc_user['uid']))) { $register = L::loadClass('Register'); $register->appendUser($uc_user['uid'], $uc_user['username'], $password, $uc_user['email']); $men = getLoginUser($uc_user['uid']); } if (empty($men)) { $GLOBALS['errorname'] = $username; //Showmsg('user_not_exists'); return 'user_not_exists'; } $e_login = explode("|", $men['onlineip']); if ($e_login[0] == $onlineip . ' *' && $timestamp - $e_login[1] < 600 && $e_login[2] < 2) { $GLOBALS['L_T'] = 600 - ($timestamp - $e_login[1]); //Showmsg('login_forbid'); return 'login_forbid'; } if ($men['yz'] > 1) { $GLOBALS['jihuo_uid'] = $men['uid']; //Showmsg('login_jihuo'); return 'login_jihuo'; } if ($uc_user['status'] == -2 || $db_ifsafecv && $men['safecv'] != $safecv) { global $L_T; $L_T = $timestamp - $e_login[1] > 600 ? 6 : intval($e_login[2]); $L_T--; $F_login = "******"; $db->update("UPDATE pw_memberdata SET onlineip=" . pwEscape($F_login) . " WHERE uid=" . pwEscape($uc_user['uid'])); //Showmsg('login_pwd_error'); return 'login_pwd_error'; } $diff_sql = array(); if ($men['password'] != $password) { $diff_sql['password'] = $password; } if ($men['email'] != $uc_user['email']) { $diff_sql['email'] = $uc_user['email']; } if ($diff_sql) { $db->update("UPDATE pw_members SET " . pwSqlSingle($diff_sql) . ' WHERE uid=' . pwEscape($uc_user['uid'])); } $winduid = $men['uid']; $groupid = $men['groupid'] == '-1' ? $men['memberid'] : $men['groupid']; $windpwd = PwdCode($password); //Start Here会员排行榜 if ($db_ifpwcache & 1) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($men); } //End Here return array($winduid, $groupid, $windpwd, $uc_user['synlogin']); }
function is_user_brand() { // $user = session('user_auth'); // return $user['is_brand']!=0; $loginuser = getLoginUser(); return $loginuser['is_brand'] != 0; }
function checkpass($username, $password, $safecv, $lgt = 0, $checkQuestion = true) { global $db_ifsafecv, $db_ifpwcache, $db, $timestamp, $onlineip; if (!checkLgt($lgt)) { //Showmsg('login_errortype'); return 'login_errortype'; } require_once R_P . 'uc_client/uc_client.php'; $uc_user = uc_user_login($username, $password, $lgt); if ($uc_user['status'] == -1) { $GLOBALS['errorname'] = $username; //Showmsg('user_not_exists'); return 'user_not_exists'; } if ($uc_user['status'] == -3) { //Showmsg('reg_email_have_same'); return 'reg_email_have_same'; } if (!($men = getLoginUser($uc_user['uid']))) { $register = L::loadClass('Register', 'user'); $register->appendUser($uc_user['uid'], $uc_user['username'], $password, $uc_user['email']); $men = getLoginUser($uc_user['uid']); } if (empty($men)) { $GLOBALS['errorname'] = $username; //Showmsg('user_not_exists'); return 'user_not_exists'; } $e_login = explode("|", $men['onlineip']); if ($e_login[0] == $onlineip . ' *' && $timestamp - $e_login[1] < 600 && $e_login[2] < 1) { $GLOBALS['L_T'] = 600 - ($timestamp - $e_login[1]); //Showmsg('login_forbid'); return 'login_forbid'; } if ($uc_user['status'] == -2 || $db_ifsafecv && $checkQuestion == true && $men['safecv'] != $safecv) { global $L_T; $L_T = $timestamp - $e_login[1] > 600 ? 6 : intval($e_login[2]); $L_T--; $F_login = "******"; $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($uc_user['uid'], array(), array('onlineip' => $F_login)); //Showmsg('login_pwd_error'); if ($uc_user['status'] == -2) { return 'login_usernamepwd_error'; } elseif ($db_ifsafecv && $men['safecv'] != $safecv) { if ($checkQuestion) { return 'login_safecv_error'; } } else { return 'login_pwd_error'; } } if ($men['yz'] > 1) { $GLOBALS['jihuo_uid'] = $men['uid']; //Showmsg('login_jihuo'); return 'login_jihuo'; } $diff_sql = array(); if ($men['password'] != $password) { $diff_sql['password'] = $password; } if ($men['email'] != $uc_user['email']) { $diff_sql['email'] = $uc_user['email']; } if ($diff_sql) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($uc_user['uid'], $diff_sql); } $winduid = $men['uid']; $groupid = $men['groupid'] == '-1' ? $men['memberid'] : $men['groupid']; $windpwd = PwdCode($password); //Start Here会员排行榜 if ($db_ifpwcache & 1) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($men); } //End Here //pig-head recycle $user_icon = explode('|', $men['icon']); if ($user_icon[4] && $men['tooltime'] < $timestamp - 86400) { $user_icon[4] = 0; $men['icon'] = implode('|', $user_icon); pwQuery::update('pw_members', 'uid =:uid', array($winduid), array('icon' => $men['icon'])); } //end return array($winduid, $groupid, $windpwd, $uc_user['synlogin'], $men['safecv']); }
protected function _initialize() { define('UID', is_user_login()); if (!UID) { // 还没登录 跳转到登录页面 $this->redirect('Home/Index/index'); } if (!IS_AJAX) { Cookie('__lastpage__', Cookie('__thispage__')); Cookie('__thispage__', $_SERVER['REQUEST_URI']); } $loginuser = getLoginUser(); $this->user = $loginuser['UserExtension']['name_cn']; $this->assign("useravatar", "/Public/uploads/em_avatar/" . $loginuser['UserExtension']['avatar']); $isMc = D("User")->isMc(UID); $isChannel = D("User")->isChannel(UID); $isReception = D("User")->isReception(UID); if (empty($isReception)) { $isReception = 0; } if ($isMc) { $start_time = date("Y-m"); $st = McService::getInstance()->getUserOneMonthStatistics(UID, $start_time); if (!empty($st)) { $this->mc_protential_persent = ceil($st[0]["protential_value"] * 10000 / $st[0]["protential_plan"]) / 100; $this->mc_transform_persent = ceil($st[0]["transform_value"] * 10000 / $st[0]["transform_plan"]) / 100; $this->mc_protential_value = $st[0]["protential_value"]; $this->mc_protential_plan = $st[0]["protential_plan"]; $this->mc_transform_value = $st[0]["transform_value"]; $this->mc_transform_plan = $st[0]["transform_plan"]; } else { $isMc = 0; } } if ($isChannel) { $start_time = date("Y-m"); $st = ChannelService::getInstance()->getUserOneMonthStatistics(UID, $start_time); if (!empty($st)) { $this->channel_protential_persent = ceil($st[0]["protential_value"] * 10000 / $st[0]["protential_plan"]) / 100; $this->channel_channel_persent = ceil($st[0]["channel_value"] * 10000 / $st[0]["channel_plan"]) / 100; $this->channel_channel_value = $st[0]["channel_value"]; $this->channel_channel_plan = $st[0]["channel_plan"]; $this->channel_protential_value = $st[0]["protential_value"]; $this->channel_protential_plan = $st[0]["protential_plan"]; } else { $isChannel = 0; } } $this->isReception = $isReception; $this->show_plan = $isMc || $isChannel; $this->isMc = $isMc; $this->uid = UID; $this->club_id = get_club_id(); $this->isChannel = $isChannel; $this->checkRole(); //通知 $model = D("Notice"); $brand_id = get_brand_id(); $ret = $model->getLatestNotice($brand_id); $this->notice = nl2br($ret['content']); if (!IS_AJAX) { $this->loadMenus(); } }