<?php
if (!isset($_SESSION['user_id'])) {
    header('Location: ' . BASE_URL . '/index.php');
    exit;
}

// Verifica permissões específicas
function requireAdmin() {
    if (!isset($_SESSION['user_type']) || $_SESSION['user_type'] !== 'admin') {
        header('Location: ' . BASE_URL . '/index.php');
        exit;
    }
}

function requireMedico() {
    if (!isset($_SESSION['user_type']) || $_SESSION['user_type'] !== 'medico') {
        header('Location: ' . BASE_URL . '/index.php');
        exit;
    }
}
?> 