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; }