<?php
session_start();

// Clear all session variables
$_SESSION = array();

// Destroy the session
session_destroy();

// Clear all cookies
if (isset($_COOKIE['auth_token'])) {
    setcookie('auth_token', '', time() - 3600, '/');
}
if (isset($_COOKIE['remembered_national_id'])) {
    setcookie('remembered_national_id', '', time() - 3600, '/');
}
if (isset($_COOKIE['remembered_name'])) {
    setcookie('remembered_name', '', time() - 3600, '/');
}
if (isset($_COOKIE['PHPSESSID'])) {
    setcookie('PHPSESSID', '', time() - 3600, '/');
}

// Redirect to login page
header("Location: new_login.php");
exit();
?>