<?php
// admin/logout.php  (PHP-only, no HTML, no closing "
session_start();

// Clear session data
$_SESSION = [];
if (ini_get('session.use_cookies')) {
    $p = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $p['path'], $p['domain'], $p['secure'], $p['httponly']);
}

// Destroy session and regenerate a fresh ID
session_destroy();
session_regenerate_id(true);

// Redirect to the login page (absolute path is safest on XAMPP)
header('Location: /globalgardenia/admin/login.php');
exit;
