public function login($email, $pass) { $rs = array(); $model = new Model_User(); $rs = $model->login($email, $pass); return $rs; }
public function action_login() { if (Auth::instance()->logged_in()) { Request::instance()->redirect('/'); } $this->template->title = "Login"; if (isset($_POST['username'])) { $user = new Model_User(); $status = $user->login($_POST, 'front/index'); if (!$status) { $this->template->content->status = $status; } } }
public function configureData() { // Select the user corresponding to the this login and password $rs = DB::select(' SELECT `id`,`login`, `key` FROM `user` WHERE `login`="' . $_POST['login'] . '" AND `password`="' . md5($_POST['password']) . '" AND `valided`=1 '); // If there is none do nothing if ($rs['total'] == 0) { echo '0'; } else { $user = new Model_User((int) $rs['data'][0]['id']); $user->login(); echo '1'; } }
public function loginAction() { $params = $this->getAllParams(); $userModel = new Model_User(); try { $user = $userModel->login($params); $this->setSessParam('currentUser', $user->id); if ($this->getParamByKey('save') == 'true') { $this->setSessParam('is_save', 1); } $userData = array('id' => $user->id, 'email' => trim($params['email']), 'role_id' => $user->role_id); echo json_encode($userData); die; } catch (Exception $e) { echo json_encode(array('error' => $e->getMessage())); die; } }
/** * 登录 * */ public function loginAction() { // 提交 if ($this->request->isPost()) { $post = $this->request->getPost(); $model = new Model_User(); $result = $model->login($post['username'], $post['passwd']); // 登录成功跳到首页 if ($result == 0) { // 如果有跳转地址 $bgurl = $this->request->getGet('bgurl'); if ($bgurl) { $this->location($bgurl); } else { $this->gotoUri('index', 'index'); } } else { $msgArr = array('-1' => L('account_error'), '-2' => L('account_disabled')); $this->msgbox($msgArr[$result]); } } }
public function configureData() { $top = new Block_Top($this->tpl); $top->configure(); $id = $this->getParameter('u'); $key = $this->getParameter('k'); if (Tool::isOk($id) && Tool::isOk($key)) { // If some user are connected if ($user = Model_User::getLoggedUser()) { $this->tpl->assignSection('confirm_ok'); } else { if (Model_User::isKeyValid($id, $key)) { Model_User::validateRegistration($id); Model_User::login($id); $this->tpl->assignSection('confirm_ok'); } else { $this->tpl->assignSection('confirm_error'); } } } else { $this->tpl->assignSection('confirm_wait'); } }
/** User logs in */ public function login() { Model_User::login($_REQUEST['l'], $_REQUEST['p']); }
if ($objUser->checkExistUserName($userName)) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(2, 'Tên đăng nhập đã tồn tại'), array(0, 1)); return; } if ($objUser->checkExistEmail($email)) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(3, 'Email đã tồn tại'), array(0, 1)); return; } $resultID = $objUser->register($userName, $password, $fullname, $birthDate, $email, $sex); if ($resultID) { //login after register $result = $objUser->login($userName, $password); if ($result) { $_SESSION[global_common::SES_C_USERINFO] = $result; } $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf', 'rurl'), array(1, 'Đăng ký thành công', $_SESSION[global_common::SES_C_CUR_PAGE]), array(0, 1, 1)); return; } else { echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(0, 'Đăng ký thất bại'), array(0, 1)); return; } } else { if ($_pgR["act"] == Model_User::ACT_UPDATE_PROFILE) { $fullname = $_pgR['fullname']; $fullname = html_entity_decode($fullname, ENT_COMPAT, 'UTF-8');
<?php require_once './global.php'; require_once './helpers/unsecure.php'; extract(GenericHelper::gatherPostData()); if (isset($username) && isset($password) && Model_User::userExists($username, $password)) { Model_User::login($username, $password); $rdr_to = GenericHelper::getRedirectTo(); if (isset($rdr_to)) { header("Location: {$rdr_to}"); die; } header("Location: loginpage.php"); } else { header("Location: index.php?err=login-unsuccessful#login"); die; }
/** * 用户登录 */ public function loginAction() { if ($this->isPost()) { $iType = $this->getParam('type'); $sUser = $this->getParam('user'); $sPass = $this->getParam('pass'); $sCode = $this->getParam('code'); $aErr = array(); if (!Util_Verify::checkImageCode($iType, $sCode)) { $aErr['code'] = '验证码错误'; } if (empty($sUser)) { $aErr['user'] = '******'; } else { $aUser = Model_User::getUserByEmail($sUser, $iType); if (empty($aUser)) { $aErr['user'] = '******'; } elseif (Model_User::makePassword($sPass) != $aUser['sPassword']) { $aErr['pass'] = '******'; } } if (!empty($aErr)) { return $this->showMsg($aErr, false); } $aCookie = Model_User::login($aUser); return $this->showMsg($aCookie, true); } else { $this->assign('iType', max(1, intval($this->getParam('type')))); $this->assign('retUrl', $this->getParam('ret')); $this->setMeta('user_login', array('sTitle' => '用户登录')); } }