public static function loginAction() { $username = $_POST['username']; $password = $_POST['password']; $loginModel = new LoginModel(); $roleId = $loginModel->authenticate($username, $password); if ($roleId == "error") { header('Location: /login/3'); } $userModel = new UserModel(); if (!$userModel->isEnabled($username)) { header('Location: /login/2'); } $_SESSION['role'] = $roleId; $_SESSION['username'] = $username; $_SESSION['userid'] = $userModel->getUserID($username); $_SESSION['title'] = (new ConfigurationModel())->getConfiguration("title")["value"]; $_SESSION['description'] = (new ConfigurationModel())->getConfiguration("description")["value"]; header('Location: ' . static::$rolesAction[$roleId]); }