Skip to content
Snippets Groups Projects
Commit fdffdbec authored by Bitha17's avatar Bitha17
Browse files

edit logout handling

parent a51d4a5d
Branches
Tags
No related merge requests found
...@@ -105,6 +105,11 @@ class UserController { ...@@ -105,6 +105,11 @@ class UserController {
header("Location:Views/login/register.php"); header("Location:Views/login/register.php");
ob_end_flush(); ob_end_flush();
} }
} elseif ($_POST['userAction'] === 'logout') {
echo "here";
$this->logout();
header("Location:Views/login/login.php");
ob_end_flush();
} else { } else {
// Handle other actions here, if needed // Handle other actions here, if needed
} }
......
...@@ -105,8 +105,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { ...@@ -105,8 +105,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$loginEmail = $_POST['loginEmail']; $loginEmail = $_POST['loginEmail'];
$loginPassword = $_POST['loginPassword']; $loginPassword = $_POST['loginPassword'];
echo $userController->loginByEmail($loginEmail,$loginPassword); echo $userController->loginByEmail($loginEmail,$loginPassword);
} elseif ($_POST['userAction'] === 'logout') { // } elseif ($_POST['userAction'] === 'logout') {
echo $userController->logout(); // echo $userController->logout();
} }
} }
} }
...@@ -142,7 +142,7 @@ $users = $userController->getAllUsers(); ...@@ -142,7 +142,7 @@ $users = $userController->getAllUsers();
<li><a href="#">History</a></li> <li><a href="#">History</a></li>
<!-- Logout Button --> <!-- Logout Button -->
<li> <li>
<form method="post" action="home.php"> <form method="post" action="app/router.php">
<button type="submit" name="userAction" value="logout">Logout</button> <button type="submit" name="userAction" value="logout">Logout</button>
</form> </form>
</li> </li>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<li><a href="#">History</a></li> <li><a href="#">History</a></li>
<!-- Logout Button --> <!-- Logout Button -->
<li> <li>
<form method="post" action="home.php"> <form method="post" action="app/router.php">
<button type="submit" name="userAction" value="logout">Logout</button> <button type="submit" name="userAction" value="logout">Logout</button>
</form> </form>
</li> </li>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment