From 82cb01ff1815ee7a7f70e0b8ed516c0b5e564a59 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:06:37 +0100 Subject: [PATCH] Add possibility to logout --- Controllers/UserController.php | 7 +++++++ Views/user/view.php | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Controllers/UserController.php b/Controllers/UserController.php index 761d798..86656d7 100644 --- a/Controllers/UserController.php +++ b/Controllers/UserController.php @@ -69,6 +69,13 @@ final class UserController } + public function logoutAction(Array $A_urlParams = null, Array $A_postParams = null) + { + session_start(); + session_destroy(); + header("Location: /"); + } + public function viewAction(Array $A_urlParams = null, Array $A_postParams = null) { if(count($A_urlParams)!=0){ diff --git a/Views/user/view.php b/Views/user/view.php index 9d35810..d5412b5 100644 --- a/Views/user/view.php +++ b/Views/user/view.php @@ -1,4 +1,8 @@
Your account :
Email : = $A_view["EMAIL"] ?>
Name : = $A_view["USERNAME"] ?>
-Admin status : = $A_view["ADMIN"] ? "yes" : "no" ?>
\ No newline at end of file +Admin status : = $A_view["ADMIN"] ? "yes" : "no" ?>
+ +