<?php
/**
 * Check current user and permissions
 */

require_once dirname(__DIR__) . '/config/config.php';
require_once dirname(__DIR__) . '/config/auth.php';

echo "<h1>Current User Information</h1>";

if (!is_logged_in()) {
    echo "<p style='color: red'>Not logged in!</p>";
    echo "<p><a href='login.php'>Go to Login</a></p>";
    exit;
}

$user = current_user();
echo "<h2>User Details:</h2>";
echo "<pre>";
print_r($user);
echo "</pre>";

echo "<h2>Session Data:</h2>";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";

echo "<h2>Permissions:</h2>";
$permissions = get_user_permissions();
echo "<pre>";
print_r($permissions);
echo "</pre>";

echo "<p><a href='admin/dashboard.php'>Admin Dashboard</a></p>";
echo "<p><a href='dashboard.php'>Public Dashboard</a></p>";
echo "<p><a href='logout.php'>Logout</a></p>";