<?php

/**
 * DEMOBANK DATABASE CONNECTION FILE
 * - Central DB connection
 * - Used across entire system
 */

$host = "localhost";
$dbname = "ubafrica_tx";
$username = "ubafrica_tx";
$password = "oX[T!+#R}8@-";

// Create connection
$conn = new mysqli($host, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    error_log("Database Connection Failed: " . $conn->connect_error);

    die("
        <h2>Database Connection Error</h2>
        <p>Please check your database settings in <b>includes/db.php</b></p>
    ");
}

// Set charset (important for banking + international data)
$conn->set_charset("utf8mb4");

/**
 * OPTIONAL: helper function for safe queries (future use)
 */
function db() {
    global $conn;
    return $conn;
}