<?php
// Start session only if not already active
if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}

function require_student() {
    if (empty($_SESSION['student'])) {
        header('Location: /index.php');
        exit;
    }
}

function require_admin() {
    if (empty($_SESSION['admin'])) {
        header('Location: /admin/login.php');
        exit;
    }
}
