<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// If an admin is logged in, send them to the dashboard.
if (isset($_SESSION['admin_id']) && isset($_SESSION['admin_role']) && $_SESSION['admin_role'] === 'admin') {
    header("Location: dashboard.php");
} else {
    // Otherwise, send them to the new login page.
    header("Location: login.php");
}
exit();
