<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

/* =====================================
   DATABASE CONFIGURATION
===================================== */

$DB_HOST = "localhost";
$DB_USER = "maxtecho_sndb";        // your DB username
$DB_PASS = "Lucifer3.0";   // your DB password
$DB_NAME = "maxtecho_sndb";   // your DB name

$conn = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);

if ($conn->connect_error) {
    die("Database connection failed");
}

/* =====================================
   SESSION & SECURITY
===================================== */

session_start();
date_default_timezone_set("Asia/Colombo");

/* =====================================
   SECURITY FUNCTIONS
===================================== */

function checkLogin() {
    if (!isset($_SESSION['admin'])) {
        header("Location: login.php");
        exit;
    }
}

function clean($data) {
    return htmlspecialchars(trim($data));
}
?>
