<?php
if (!isset($_SESSION)) session_start();
$page = basename($_SERVER['PHP_SELF']);
$publicPages = ['index.php', 'forgot-password.php', 'reset-verify.php'];
if (!in_array($page, $publicPages) && empty($_SESSION['admin_logged_in'])) {
    header('Location: index.php'); exit;
}
if (in_array($page, $publicPages) && !empty($_SESSION['admin_logged_in'])) {
    header('Location: dashboard.php'); exit;
}
