Files
sidak/logout.php

38 lines
823 B
PHP
Executable File

<?php
// Turn off error reporting to prevent warnings
error_reporting(0);
// Prevent any output
ob_start();
// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
@session_start();
}
// Clear session data
$_SESSION = [];
// Delete session cookie
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 3600,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Destroy session if active
if (session_status() === PHP_SESSION_ACTIVE) {
@session_destroy();
}
// Clear output buffer
ob_end_clean();
// Set headers
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
header("Location: login.php");
exit();