<?php
// ================= SESSION =================
session_start();

// ================= DATABASE CONFIG =================
$hostname     = "localhost";          // MySQL host
$username     = "bizmessa_Upen";       // MySQL username
$password     = "Upen@1902";           // MySQL password
$databasename = "bizmessa_pmonitor";  // Database name

// ================= CONNECTION =================
$conn = new mysqli($hostname, $username, $password, $databasename);

if ($conn->connect_error) {
    die("Database connection failed: " . $conn->connect_error);
}
 

$TBL_PROJECTS = "projects";
$TBL_PROJECT_BLOG = "project_blog";
$TBL_PROJECT_BLOG_FILES = "project_blog_files";

// ================= TIMEZONE =================
date_default_timezone_set("Asia/Kolkata");

// ================= CLIENT IP =================
function getClientIP(){
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP'];
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) return explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
    return $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
}

$ip = $conn->real_escape_string(getClientIP());
?>
