diff --git a/post.php b/post.php index 3fc24216..f09d2141 100644 --- a/post.php +++ b/post.php @@ -55,12 +55,13 @@ if (str_contains($module, 'admin') && isset($session_is_admin) && $session_is_ad } +// Logout is the same for user and admin +require_once "post/logout.php"; // TODO: Move admin_update into the admin section to be auto-loaded // We can't do this until everyone has the new database fields added in 1.4.9 on Sept 14th 2024 require_once "post/admin_update.php"; // Load updater - // TODO: Find a home for these require_once "post/ai.php"; diff --git a/post/logout.php b/post/logout.php new file mode 100644 index 00000000..3645d4f6 --- /dev/null +++ b/post/logout.php @@ -0,0 +1,30 @@ + diff --git a/post/user/profile.php b/post/user/profile.php index 92269aab..a2eaf6e0 100644 --- a/post/user/profile.php +++ b/post/user/profile.php @@ -285,22 +285,3 @@ if (isset($_POST['revoke_your_2fa_remember_tokens'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } - -if (isset($_GET['logout'])) { - mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Logout', log_action = 'Success', log_description = '$session_name logged out', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); - mysqli_query($mysqli, "UPDATE users SET user_php_session = '' WHERE user_id = $session_user_id"); - - setcookie("PHPSESSID", '', time() - 3600, "/"); - unset($_COOKIE['PHPSESSID']); - - setcookie("user_encryption_session_key", '', time() - 3600, "/"); - unset($_COOKIE['user_encryption_session_key']); - - setcookie("user_extension_key", '', time() - 3600, "/"); - unset($_COOKIE['user_extension_key']); - - session_unset(); - session_destroy(); - - header('Location: login.php?key=' . $config_login_key_secret); -}