<?php
require_once 'config.php';

if (isLoggedIn()) {
    if ($_SESSION['role'] === 'admin') {
        header('Location: admin/');
    } else {
        header('Location: public/dashboard.php');
    }
} else {
    header('Location: login.php');
}
exit;
?>