<?php
// Start the session
session_start();

// Check if the email session variable is set
if (!isset($_SESSION['email'])) {
    // Redirect to index.php with a timeout message
    header("Location: index.php?msg=timeout");
    exit(); // Make sure to call exit after redirecting
} else {
    // Access session variables safely
    $email = $_SESSION["email"];
    
    // Check if role is set in session
    if (isset($_SESSION["role"])) {
        $role = $_SESSION["role"];
    } else {
        // Handle case where 'role' is not set
        // Redirect to an error page or show an error message
        header("Location: error.php?msg=role_not_set");
        exit();
    }
}
?>
