Files
2025-09-28 16:05:53 +02:00

28 lines
812 B
PHP

<?php
require_once 'include/init.php';
// Clear specific session variables for guest or user logout
if (isset($_SESSION['guest_tab_id'])) {
unset($_SESSION['guest_tab_id']);
}
// Unset all of the session variables for a full user logout.
$_SESSION = [];
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Finally, destroy the session.
session_destroy();
// Always redirect to the login page after destroying the session for clear feedback.
header('Location: login.php');
exit;