<?php
// admin/_auth.php  — shared auth guard, include at top of every admin page
session_start();
require_once dirname(__DIR__) . '/config.php';

function adm_is_logged_in(): bool {
    return isset($_SESSION['adm_logged_in']) && $_SESSION['adm_logged_in'] === true;
}

function adm_require_login(): void {
    if (!adm_is_logged_in()) {
        header('Location: login.php');
        exit;
    }
}
