Ejemplo n.º 1
0
 public function Login()
 {
     /*lusb*/
     if ($this->UserID) {
         header('Location: ?module=AdminCP&action=Frame');
         exit;
     }
     if ($this->_POST) {
         $UserName = strtolower(trim($this->_POST['UserName']));
         $Password = $this->_POST['Password'];
         if (!$UserName || !$Password) {
             JsMessage('您没有填写完整,登陆名和密码都不能不填!');
         }
         $Users = new UsersModule();
         $RedirectURL = trim($this->_POST['RedirectURL']);
         $Result = $Users->Login($UserName, $Password);
         switch ($Result) {
             case -1:
                 $this->__Message('非法登陆名, 请确认您的登陆名是否有误!');
                 break;
             case -2:
                 $this->__Message('非法登陆名或错误密码, 请确认您的登陆名和密码!');
                 break;
             case -3:
                 $this->__Message('您的用户不允许登陆, 若有疑问请与管理员联系!');
                 break;
             default:
                 $Users->Session('UserID', $Result);
                 if ($RedirectURL) {
                     $this->__Message(htmlencode($UserName) . ', 您已经成功登陆!', $RedirectURL, '继续操作');
                 } else {
                     $this->__Message(htmlencode($UserName) . ', 您已经成功登陆!', UrlRewriteSimple('AdminCP', 'Frame'), '继续操作');
                 }
         }
     }
     if ($this->_GET['RedirectURL']) {
         $this->RedirectURL = $this->_GET['RedirectURL'];
     }
 }