<?php
/**
 * Admin Authentication Functions
 */

function checkAdminAuth() {
    if (!isset($_SESSION['admin_user_id'])) {
        header('Location: login.php');
        exit;
    }
}

function requireAdminRole($requiredRole = 'admin') {
    checkAdminAuth();
    if ($_SESSION['admin_role'] !== $requiredRole && $_SESSION['admin_role'] !== 'admin') {
        header('Location: dashboard.php');
        exit;
    }
}

