From 8305e3c48723af49f48faebd0be4710719ffdf08 Mon Sep 17 00:00:00 2001 From: Eirik Th S Date: Mon, 21 Jun 2021 15:17:49 +0200 Subject: [PATCH] Somewhat added a logout --- www/logout.php | 13 +++++++++++++ www/webdata/init.php | 19 ++++++++++++++++++- www/webdata/navbar.php | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 www/logout.php diff --git a/www/logout.php b/www/logout.php new file mode 100644 index 0000000..37f5a9c --- /dev/null +++ b/www/logout.php @@ -0,0 +1,13 @@ + - \n"; } @@ -109,6 +110,22 @@ function loginUser($email, $pass) { return $err; } +function logoutUser(){ + if(checkLogin()){ + + } + + // Delete session-cookie + $params = session_get_cookie_params(); + setcookie(session_name(), '', time() - 42000, + $params["path"], $params["domain"], + $params["secure"], $params["httponly"] + ); + + // Finally, destroy the session. + session_destroy(); +} + function PwdGen($pass, $returnHashed = false): string { global $config; diff --git a/www/webdata/navbar.php b/www/webdata/navbar.php index 9cd07bd..706fce0 100644 --- a/www/webdata/navbar.php +++ b/www/webdata/navbar.php @@ -16,7 +16,7 @@ if($activePage == "/index.php"){ $activePage = "/"; } $href){ echo '