Ejemplo n.º 1
0
 public function loginAction()
 {
     if ($_SESSION['log']) {
         $this->_redirect('admin/index/home');
     } else {
         $this->view->headTitle($this->config['title']['login']);
         if (isset($_POST['btnSubmit'])) {
             $email = $_POST['email'];
             $password = $_POST['password'];
             $remember = $_POST['remember'];
             $salt = md5($email);
             $password_md5 = md5($password);
             $password = md5($password_md5 . $salt);
             $userMapper = new Cloud_Model_User_CloudUserMapper();
             if ($userMapper->isValidate($email, $password)) {
                 $currentUser = $userMapper->findUserByEmail($email);
                 $_SESSION['userId'] = $currentUser['id'];
                 $_SESSION['role_name'] = $currentUser['role_name'];
                 $_SESSION['full_name'] = $currentUser['full_name'];
                 $_SESSION['avatar'] = $currentUser['avatar'];
                 $_SESSION['privilege'] = $userMapper->getRolePrivilegeById($currentUser['id']);
                 $_SESSION['log'] = true;
                 $this->_redirect('admin/index/home');
             } else {
                 $this->view->message = 'Thông tin đăng nhập không đúng';
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function updatePlayerTotalPagesUserAction()
 {
     $flag = false;
     foreach ($this->privileges as $privilege) {
         if ($privilege['id'] == 1) {
             $flag = true;
         }
     }
     if (!$flag) {
         $this->_redirect('admin/index/error');
     }
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     if (null != $this->request->getParam('number')) {
         $number = $this->request->getParam('number');
         $userMapper = new Cloud_Model_User_CloudUserMapper();
         echo $userMapper->updateTotalPages($number);
     }
 }