Example #1
0
 $userQ = new Query_User();
 if (!$userQ->existLogin($loginSession)) {
     $errorFound = true;
     $formError["login_session"] = _("Login unknown.");
     $sessLoginAttempts = 1;
     $_SESSION['auth']['last_login'] = '';
 } else {
     if (!$userQ->isActivated($loginSession)) {
         $userQ->close();
         $_SESSION = array();
         // deregister all current session variables
         FlashMsg::add(_("Your user account has been suspended. Contact with administrator to resolve this problem."));
         header("Location: ../home/index.php");
         exit;
     }
     $formSession = Form::getSession();
     $lastLogin = isset($_SESSION['auth']['last_login']) ? $_SESSION['auth']['last_login'] : '';
     if (!$userQ->verifySignOn($loginSession, $pwdSession)) {
         $userQ->close();
         Error::query($userQ);
     }
     $user = $userQ->fetch();
     if (!$user) {
         /**
          * Invalid password. Add one to login attempts.
          */
         $errorFound = true;
         $formError["pwd_session"] = _("Invalid sign on.");
         if (!isset($_SESSION['auth']['login_attempts']) || $_SESSION['auth']['login_attempts'] == "") {
             $sessLoginAttempts = 1;
         } else {