<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/session_bootstrap.php';

echo "=== Session Debug ===\n\n";
echo "logged_in: " . (isset($_SESSION['logged_in']) ? ($_SESSION['logged_in'] ? 'YES' : 'NO') : 'NOT SET') . "\n";
echo "role: " . (isset($_SESSION['role']) ? $_SESSION['role'] : 'NOT SET') . "\n";
echo "user_id: " . (isset($_SESSION['user_id']) ? $_SESSION['user_id'] : 'NOT SET') . "\n";
echo "\nFull Session:\n";
print_r($_SESSION);

echo "\n=== Access Check ===\n";
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true) {
    echo "✅ Logged in\n";
} else {
    echo "❌ NOT logged in\n";
}

if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin') {
    echo "✅ Admin role\n";
} else {
    echo "❌ NOT admin (role: " . (isset($_SESSION['role']) ? $_SESSION['role'] : 'NOT SET') . ")\n";
}
?>
