/** * 登录验证 */ private function chklogin() { $account = htmlspecialchars(trim($_GET['account_' . FORMHASH])); $password = trim($_GET['password_' . FORMHASH]); $captchacode = strtolower(trim($_GET['captchacode'])); $this->checkCaptchacode($captchacode); if (strlen($account) < 2) { $this->showError('username_verify_failed'); } if (strlen($password) < 6) { $this->showError('password_verify_failed'); } $member = new Member(); if (isemail($account)) { $returns = $member->Login($account, $password, 'email'); } elseif (ismobile($account)) { $returns = $member->Login($account, $password, 'mobile'); } else { $returns = $member->Login($account, $password); } if ($member->uid > 0) { $continue = $_GET['continue']; $this->showSuccess('login_succeed', $continue, array(), '', true); } else { $this->showError('login_verify_failed'); } }
/** * 登录验证 */ public function login() { $account = htmlspecialchars(trim($_GET['account'])); $password = trim($_GET['password']); $captchacode = trim($_GET['captchacode']); if ($captchacode && $captchacode != getcookie('captchacode')) { $this->showAppError(-1, '验证码输入错误', array('code' => $captchacode)); } if (strlen($account) < 2) { $this->showAppError(-2, '账号输入不正确', array('account' => $account)); } if (strlen($password) < 6) { $this->showAppError(-3, '密码输入不正确', array('password' => $password)); } $member = new Member(); if (isemail($account)) { $returns = $member->Login($account, $password, 'email'); } elseif (ismobile($account)) { $returns = $member->Login($account, $password, 'mobile'); } if ($member->uid < 0) { $returns = $member->Login($account, $password); } if ($member->uid > 0) { $returns['userpic'] = avatar($member->uid); $this->showAppData($returns); } else { $this->showAppError(-4, '账号和密码不匹配', array('account' => $account, 'password' => $password)); } }