function loginPost() { if (isset($_POST["identify"]) && isset($_POST["password"])) { //Attemp to log user in ModelFacade::login($_POST["identify"], $_POST["password"]); if (ModelFacade::checkLoggedIn()) { //redirect header('Location: Index.php'); exit; } else { if (ModelFacade::checkIfBanned($_POST["identify"])) { $message = "Your account has been banned!"; include_once "/Views/Login.html"; } else { $message = "Username or password does not exist"; include_once "/Views/Login.html"; } } } else { $message = "Please enter username and password"; include_once "/Views/Login.html"; } }
public static function kickIfBannedOrDeleted() { if (ModelFacade::checkLoggedIn()) { $userObj = ModelFacade::getLoggedInUser(); $test = $userObj->checkIfBannedOrDeleted(); if ($test) { ModelFacade::logout(); header("Location: /Login.php"); } } }