<?php
// Define log file path
$logFile = 'db_connection.log';

// Create a log message function
function logMessage($message) {
    global $logFile;
    $timestamp = date("Y-m-d H:i:s");
    file_put_contents($logFile, "[$timestamp] $message\n", FILE_APPEND);
}

// Attempt to connect to the database
$conn = new mysqli("210.89.47.45", "xesstech_dayloan", "Kanxtl@6868#", "xesstech_dayloan");

// Check connection
if ($conn->connect_error) {
    logMessage("Connection failed: " . $conn->connect_error);
    // Optionally show a user-friendly error
    //  die("Database connection failed.");
} else {
    logMessage("Connected successfully");
    //  echo "Connected successfully";
}
?>
