<?php
// ضعه في مجلد public/ وليس الجذر
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "Step 1: Loading constants...<br>";
require_once __DIR__ . '/../config/constants.php';
echo "OK<br>";

echo "Step 2: Loading database...<br>";
require_once __DIR__ . '/../config/database.php';
echo "OK<br>";

echo "Step 3: Loading auth...<br>";
require_once __DIR__ . '/../includes/auth.php';
echo "OK<br>";

echo "Step 4: Loading rbac...<br>";
require_once __DIR__ . '/../includes/rbac.php';
echo "OK<br>";

echo "Step 5: Starting session...<br>";
startSecureSession();
echo "OK<br>";

echo "Step 6: Checking login...<br>";
$logged = isLoggedIn();
echo "isLoggedIn = " . ($logged ? 'true' : 'false') . "<br>";

echo "<br><b style='color:green'>All OK! Problem is in index.php content itself.</b>";
