<?php
session_start();

// Only force login for pages that really require it
function require_login() {
    if (!isset($_SESSION['user_id'])) {
        $_SESSION['redirect_after_login'] = $_SERVER['REQUEST_URI'];
        header("Location: login.php"); // redirect to login page
        exit;
    }
}

// Optional: helper to check if user is logged in
$isLoggedIn = isset($_SESSION['user_id']);
$firstName = $_SESSION['firstName'] ?? '';
$isAdmin = $_SESSION['is_admin'] ?? 0;
?>
