// Debug session error_log('index.php session ID: ' . session_id() . ', username: ' . ($_SESSION['username'] ?? 'unset')); // Force HTTPS if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') { header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit; } ?>