<?php
// Database connection details
// define('DB_SERVER', 'localhost'); // Your database server (usually localhost)
// define('DB_USERNAME', 'root'); // Your database username (local development)
// define('DB_PASSWORD', ''); // Your database password (local development)
// define('DB_NAME', 'mall_leasing'); // Your database name (local development)

// For production environment (commented out for reference)
define('DB_SERVER', 'localhost'); 
define('DB_USERNAME', 'pancatz_admin');
define('DB_PASSWORD', 'hidayah1433'); // Add your actual password
define('DB_NAME', 'pancatz_mall_leasing_db');

// Attempt to connect to MySQL database
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

// Check connection
if ($conn->connect_error) {
    // In a production environment, log this error instead of displaying it
    error_log("Database connection failed: " . $conn->connect_error);
    die("ERROR: Could not connect to database. Please try again later.");
}

// Optional: Set character set to utf8mb4 for better unicode support
if (!$conn->set_charset("utf8mb4")) {
    error_log("Error loading character set utf8mb4: " . $conn->error);
}

// Start session on every page that needs it
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
?>