<?php
session_start();

if (isset($_SESSION['userID'])) {
    // User is logged in
    if ($_SESSION['role'] === 'admin') {
        // Redirect to the admin page
        header('Location: admin/index.php');
    } elseif ($_SESSION['role'] === 'user') {
        // Redirect to the user page
        header('Location: staff/index.php');
    } elseif ($_SESSION['role'] === 'manager') {
        // Redirect to the user page
        header('Location: manager/index.php');
    }
    exit;
} else {
    // User is not logged in, show the login page
    header('Location: login.php');
    exit;
}
?>