diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index fe2e83a29f143789d81eeba8f6cce72db0ee74c7..5bfaee12a16a77392bb4f0260b85a47554a468dd 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -105,6 +105,11 @@ class UserController { header("Location:Views/login/register.php"); ob_end_flush(); } + } elseif ($_POST['userAction'] === 'logout') { + echo "here"; + $this->logout(); + header("Location:Views/login/login.php"); + ob_end_flush(); } else { // Handle other actions here, if needed } diff --git a/home.php b/home.php index a043c9fe94529396b0464fc5f9e5a4eb4f6809a5..072ce25462f44d676c91ea6b2d788609485249ef 100644 --- a/home.php +++ b/home.php @@ -105,8 +105,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $loginEmail = $_POST['loginEmail']; $loginPassword = $_POST['loginPassword']; echo $userController->loginByEmail($loginEmail,$loginPassword); - } elseif ($_POST['userAction'] === 'logout') { - echo $userController->logout(); + // } elseif ($_POST['userAction'] === 'logout') { + // echo $userController->logout(); } } } @@ -142,7 +142,7 @@ $users = $userController->getAllUsers(); <li><a href="#">History</a></li> <!-- Logout Button --> <li> - <form method="post" action="home.php"> + <form method="post" action="app/router.php"> <button type="submit" name="userAction" value="logout">Logout</button> </form> </li> diff --git a/index.php b/index.php index 87b639410efd437b474569c3da4c7291a374d520..57bc80c0b59c2de9863aab09719f48ed25f38c8d 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ <li><a href="#">History</a></li> <!-- Logout Button --> <li> - <form method="post" action="home.php"> + <form method="post" action="app/router.php"> <button type="submit" name="userAction" value="logout">Logout</button> </form> </li>