<?php
require_once __DIR__ . '/includes/config.php';
session_name(SESSION_NAME);
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION = [];
session_unset();
session_destroy();
// Delete cookie forcefully
setcookie(SESSION_NAME, '', [
    'expires'  => time() - 86400,
    'path'     => '/',
    'secure'   => false,
    'httponly' => true,
    'samesite' => 'Lax',
]);
setcookie(SESSION_NAME, '', time() - 86400, '/');
// Also delete with no path
setcookie(SESSION_NAME, '', time() - 86400);
header('Location: login.php');
exit;
