<?php
// bootstrap.php - Include this at the top of every page
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// Define root path
define('ROOT_PATH', dirname(__FILE__));

// Include database configuration
require_once ROOT_PATH . '/config/db.php';

// Common functions
function isLoggedIn() {
    return isset($_SESSION['user_id']);
}

function isAdmin() {
    return isset($_SESSION['admin_id']);
}

function redirect($url) {
    header("Location: $url");
    exit();
}
?>