<?php
// Database Configuration
// Auto-detect environment (cPanel vs localhost)

$DB_HOST = 'maham.usadomainhosting.com';
$DB_USER = 'mahamusa_user';
$DB_PASS = 'tCG!c&lpxW8Q';
$DB_NAME = 'mahamusa_db';

// Flag for password storage mode (development mode = plain text for testing)
$STORE_PLAINTEXT_PASSWORDS = true;

// Create connection using MySQLi
$conn = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);

// Check connection
if ($conn->connect_error) {
    // Connection failed - log but don't display error to prevent JSON corruption
    error_log("Database Connection Error: " . $conn->connect_error);
    $conn = null;
} else {
    // Set charset to utf8mb4
    $conn->set_charset("utf8mb4");
}

// Optional: Define admin role constants
define('ROLE_ADMIN', 'administrator');
define('ROLE_SUBADMIN', 'sub-admin');
define('ROLE_USER', 'user');
?>
