当前位置: 首页>>代码示例>>PHP>>正文


PHP DashboardController::control方法代码示例

本文整理汇总了PHP中DashboardController::control方法的典型用法代码示例。如果您正苦于以下问题:PHP DashboardController::control方法的具体用法?PHP DashboardController::control怎么用?PHP DashboardController::control使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DashboardController的用法示例。


在下文中一共展示了DashboardController::control方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: control

 public function control()
 {
     $this->setPageTitle('Log in');
     $this->setViewTemplate('session.login.tpl');
     $this->view_mgr->addHelp('login', 'userguide/accounts/index');
     $this->disableCaching();
     //don't show login form if already logged in
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $owner_dao = DAOFactory::getDAO('OwnerDAO');
         if (isset($_POST['Submit']) && $_POST['Submit'] == 'Log In' && isset($_POST['email']) && isset($_POST['pwd'])) {
             if ($_POST['email'] == '' || $_POST['pwd'] == '') {
                 if ($_POST['email'] == '') {
                     $this->addErrorMessage("Email must not be empty");
                     return $this->generateView();
                 } else {
                     $this->addErrorMessage("Password must not be empty");
                     return $this->generateView();
                 }
             } else {
                 $session = new Session();
                 $user_email = $_POST['email'];
                 if (get_magic_quotes_gpc()) {
                     $user_email = stripslashes($user_email);
                 }
                 $this->addToView('email', $user_email);
                 $owner = $owner_dao->getByEmail($user_email);
                 if (!$owner) {
                     $this->addErrorMessage("Incorrect email");
                     return $this->generateView();
                 } elseif (!$owner->is_activated) {
                     $this->addErrorMessage("Inactive account. " . $owner->account_status . ". " . '<a href="forgot.php">Reset your password.</a>');
                     return $this->generateView();
                 } elseif (!$session->pwdCheck($_POST['pwd'], $owner_dao->getPass($user_email))) {
                     //failed login
                     if ($owner->failed_logins >= 10) {
                         $owner_dao->deactivateOwner($user_email);
                         $owner_dao->setAccountStatus($user_email, "Account deactivated due to too many failed logins");
                     }
                     $owner_dao->incrementFailedLogins($user_email);
                     $this->addErrorMessage("Incorrect password");
                     return $this->generateView();
                 } else {
                     // this sets variables in the session
                     $session->completeLogin($owner);
                     $owner_dao->updateLastLogin($user_email);
                     $owner_dao->resetFailedLogins($user_email);
                     $owner_dao->clearAccountStatus('');
                     $controller = new DashboardController(true);
                     return $controller->control();
                 }
             }
         } else {
             return $this->generateView();
         }
     }
 }
开发者ID:narpaldhillon,项目名称:ThinkUp,代码行数:59,代码来源:class.LoginController.php

示例2: control

 public function control()
 {
     $this->setPageTitle('Log in');
     $this->setViewTemplate('session.login.tpl');
     $this->disableCaching();
     //don't show login form if already logged in
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $od = DAOFactory::getDAO('OwnerDAO');
         if (isset($_POST['Submit']) && $_POST['Submit'] == 'Log In' && isset($_POST['email']) && isset($_POST['pwd'])) {
             if ($_POST['email'] == '' || $_POST['pwd'] == '') {
                 if ($_POST['email'] == '') {
                     $this->addErrorMessage("Email must not be empty");
                     return $this->generateView();
                 } else {
                     $this->addErrorMessage("Password must not be empty");
                     return $this->generateView();
                 }
             } else {
                 $session = new Session();
                 $user_email = $_POST['email'];
                 $this->addToView('email', $user_email);
                 $owner = $od->getByEmail($user_email);
                 if (!$owner) {
                     $this->addErrorMessage("Incorrect email");
                     return $this->generateView();
                 } elseif (!$session->pwdCheck($_POST['pwd'], $od->getPass($user_email))) {
                     $this->addErrorMessage("Incorrect password");
                     return $this->generateView();
                 } else {
                     // this sets variables in the session
                     $session->completeLogin($owner);
                     $od->updateLastLogin($user_email);
                     $controller = new DashboardController(true);
                     return $controller->control();
                 }
             }
         } else {
             return $this->generateView();
         }
     }
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:44,代码来源:class.LoginController.php


注:本文中的DashboardController::control方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。