<?php
require_once '../functions.php';

if (isset($_SESSION['admin_id']) && $_SESSION['user_type'] === 'admin') {
    logActivity('admin_logout', 'Admin logged out', null, $_SESSION['admin_id']);
}

$_SESSION = [];

if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', [
        'expires' => time() - 3600,
        'path' => '',
        'secure' => true,
        'httponly' => true,
        'samesite' => 'Strict'
    ]);
}

session_destroy();
header('Location: index.php');
exit();
?>
