Beispiel #1
0
 public function execute()
 {
     global $gvPath;
     $code = $_POST['code'];
     $password = $_POST['password'];
     session_destroy();
     unset($_SESSION);
     session_start();
     if ($this->isValidSysAdminLogin($code, $password)) {
         global $gvEditableConfs;
         $_SESSION['userLevel'] = Page::SYSADMIN_USER;
         if ($code == $gvEditableConfs[0]->getDefault() && $password == $gvEditableConfs[1]->getDefault()) {
             // Access with default credentials. Redirect to settings.
             $redirect = new RedirectOutput($gvPath . "/application/adminSettings");
         } else {
             $redirect = new RedirectOutput($gvPath . "/application/adminPage");
         }
         return $redirect;
     }
     if (Operator::isValidLogin($code, $password)) {
         Operator::clearTableForLogout($code);
         try {
             Session::loginOperator($code);
         } catch (UnknownDeskException $e) {
             global $gvPath;
             $errorPage = new ErrorPageOutput("Sportello non riconosciuto", "Il presente computer non è stato registrato come sportello.<br />" . "Indirizzo IP da registrare: " . $_SERVER['REMOTE_ADDR'], "<a href=\"{$gvPath}/application/loginPage\">Torna indietro</a>");
             return $errorPage;
         }
         $redirect = new RedirectOutput($gvPath . "/application/opPage");
         return $redirect;
     }
     // Login failed
     $this->errorMessage = "Codice o password non validi!";
     return true;
 }
Beispiel #2
0
 public static function logoutOperator()
 {
     $_SESSION['userLevel'] = Page::NORMAL_USER;
     Operator::clearTableForLogout($_SESSION['op_code']);
     unset($_SESSION['op_code']);
     unset($_SESSION['desk_number']);
     unset($_SESSION['td_served']);
 }
Beispiel #3
0
 public function isOpen()
 {
     global $gvSessionTimeout;
     if (!$this->desk_last_activity_time || !$this->desk_op_code) {
         // Closed
         return false;
     }
     $last = $this->desk_last_activity_time;
     if (time() - $last >= $gvSessionTimeout) {
         // Session timed out, update tables
         Operator::clearTableForLogout($this->desk_op_code, $this, null);
         return false;
     }
     return true;
 }