<?php
// Error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Database configuration
define('DB_HOST', 'localhost');
define('DB_NAME', 'ets_taher');
define('DB_USER', 'root');
define('DB_PASS', 'root');

// Website configuration
define('SITE_NAME', 'Ets Taher');
define('BASE_URL', 'http://localhost/ets-taher');
define('ADMIN_URL', BASE_URL . '/admin');

// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

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

// Redirect if not logged in
function requireAuth() {
    if (!isLoggedIn()) {
        header('Location: ' . ADMIN_URL . '/login.php');
        exit;
    }
}
?>