35603-vm/logout.php
Flatlogic Bot 23eab8271d v2
2025-11-09 18:56:18 +00:00

29 lines
661 B
PHP

<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
// Unset all of the session variables
$_SESSION = [];
// Destroy the session
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
session_destroy();
// Start a new session to pass a logout message
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
$_SESSION['message'] = 'You have been logged out successfully.';
$_SESSION['message_type'] = 'success';
header("Location: login.php");
exit;