Пример #1
0
 /**
  * 登录
  */
 public function actionLogin()
 {
     if ($this->_isPost()) {
         #------验证码------#
         $this->_loadCore('Help_ImgCode');
         $helpImgCode = new Help_ImgCode();
         if (!$helpImgCode->check($_POST['verify_code'])) {
             $this->_utilMsg->showMsg('您输入的验证码不正确', -1);
         }
         #------验证码------#
         $userName = trim($_POST['user_name']);
         $userInfo = $this->_modelUser->findByUserName($userName);
         if ($userInfo['password'] == md5($_POST['password'])) {
             //如果密码正确
             $this->_utilRbac->setLogin($userName);
             $utilOnline = $this->_getGlobalData('Util_Online', 'object');
             $utilOnline->setOnlineUser($userName);
             //设置在线用户
             $this->_utilMsg->showMsg(false, 1, Tools::url(CONTROL, 'Index'));
         } else {
             $this->_utilMsg->showMsg('您输入的密码不正确,或账号不存在', -2);
         }
     } else {
         $this->_view->display($this->_view->get_curPage());
     }
 }
Пример #2
0
 /**
  * 登录
  */
 public function actionLogin()
 {
     if ($this->_isPost()) {
         #------验证码------#
         $this->_loadCore('Help_ImgCode');
         $helpImgCode = new Help_ImgCode();
         if (!$helpImgCode->check($_POST['verify_code'])) {
             $this->_utilMsg->showMsg(Tools::getLang('LOGIN_ERRORAUTH', __CLASS__), -1);
         }
         #------验证码------#
         $userName = trim($_POST['user_name']);
         $userInfo = $this->_modelUser->findByUserName($userName);
         if ($userInfo && $userInfo['password'] == md5($_POST['password'])) {
             //如果密码正确
             $this->_utilRbac->setLogin($userName);
             $utilOnline = $this->_getGlobalData('Util_Online', 'object');
             $utilOnline->setOnlineUser($userName);
             //设置在线用户
             $this->_utilMsg->showMsg(false, 1, Tools::url(CONTROL, 'Index'));
         } else {
             $this->_utilMsg->showMsg(Tools::getLang('Login_ERRORPWD', __CLASS__), -2);
         }
     } else {
         $this->_view->assign('global', array('title' => Tools::getLang('TITLE', 'Common')));
         $this->_view->display();
     }
 }