<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "1<br>";
require_once './includes/session.php';
echo "2<br>";
require_once './includes/admin.php';
echo "3<br>";
require_once './includes/utils.php';
echo "4<br>";

$session = SessionManager::getInstance();
echo "5 - session OK<br>";

echo "isLoggedIn check...<br>";
if ($session->isLoggedIn()) {
    echo "User is logged in, would redirect<br>";
    exit;
}
echo "6 - not logged in<br>";

$admin = new Admin();
echo "7 - admin created<br>";

$expiryDateFromDB = $admin->getExpiryDate() ?? "2025-08-03";
echo "8 - expiry: $expiryDateFromDB<br>";

$csrfToken = Utils::generateCSRFToken();
echo "9 - csrf token generated<br>";

echo "<br>ALL PHP LOGIC WORKS. The issue is elsewhere.";
exit;
?>
