<?php

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

$host = "sdb-55.hosting.stackcp.net";
$dbname = "sitedb-35303131f6de";
$username = "sitedb-35303131f6de";
$password = "hlbz4xtla5";

// 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;
}