<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

function isLoggedIn(){
    return isset($_SESSION['patient_id']);
}

function requireLogin(){
    if(!isLoggedIn()){
        header("Location: /patient/login.php");
        exit();
    }
}

function getPatientId(){
    return $_SESSION['patient_id'] ?? null;
}
?>