<?php

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");

define('DB_HOST', 'localhost');
define('DB_USER', 'globtnqp_globinvest_user');
define('DB_PASS', 'Iamprobashi@500');
define('DB_NAME', 'globtnqp_globinvest_store');

define(
    'BASE_URL',
    'https://globinvest.online/api/'
);

function getDB(){

    static $db = null;

    if($db == null){

        $db = new mysqli(
            DB_HOST,
            DB_USER,
            DB_PASS,
            DB_NAME
        );

        if($db->connect_error){

            die(json_encode([
                "success" => false,
                "message" => "Database Failed"
            ]));
        }

        $db->set_charset("utf8mb4");
    }

    return $db;
}