<?php
require_once '../config.php';

// Ensure session is started
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Check if user is logged in
if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true) {
    // Redirect to dashboard if logged in
    header('Location: ' . BASE_URL . '/admin/dashboard');
    exit;
} else {
    // Redirect to login if not logged in
    header('Location: ' . BASE_URL . '/admin/login');
    exit;
}
