<?php
/**
 * includes/auth.php
 * Authentication helper: check if user is logged in.
 */

require_once __DIR__ . '/config.php';

function isLoggedIn() {
    return isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true;
}

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