<?php
// common/config.php
ob_start(); 
session_start();

// Database Connection
$host = "127.0.0.1";
$user = "tnbespor_topup";
$pass = "tnbespor_topup"; 
$db   = "tnbespor_topup";

$conn = new mysqli($host, $user, $pass, $db);

if ($conn->connect_error) {
    if (strpos($_SERVER['SCRIPT_NAME'], 'install.php') === false) {
        die("Connection failed: " . $conn->connect_error);
    }
}

// ==========================================
// Mr Ai Pay - API Configuration (UPDATED)
// ==========================================
$api_key    = "NjsorKw8VH5FUJcIuAdNa7q4ljutGRdkEC3YI3RjGUBHCJ0tya"; // আপনার দেওয়া Key
$secret_key = "NjsorKw8VH5FUJcIuAdNa7q4ljutGRdkEC3YI3RjGUBHCJ0tya"; // সাধারণত কি এবং সিক্রেট একই হয় অথবা ড্যাশবোর্ড থেকে আলাদাটা দিন
$brand_key  = "NjsorKw8VH5FUJcIuAdNa7q4ljutGRdkEC3YI3RjGUBHCJ0tya"; // ড্যাশবোর্ডে ব্র্যান্ড কি আলাদা থাকলে সেটি দিন
// ==========================================

// Helper: Get Setting
function getSetting($conn, $key) {
    $res = $conn->query("SELECT value FROM settings WHERE name='$key' LIMIT 1");
    if($res && $res->num_rows > 0) return $res->fetch_assoc()['value'];
    return "";
}
?>
