<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', 'C:/xampp/htdocs/webpanel/Panel/debug.log');
error_log('Config.php loaded');

#####################
#Connection Database#
#####################
// Load environment variables from a separate config file outside the web root for security
$config_file = 'C:/xampp/secure_config/db_config.php';
if (file_exists($config_file)) {
    require_once $config_file;
} else {
    error_log("Secure config file not found: " . $config_file);
    // Updated credentials
    $dbhost = "localhost";
    $dbname = "cyberbotnet";
    $dbuser = "root";
    $dbpass = "Cyberproduct123!@#"; // Updated to secure password
}

$condb = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
               
mysqli_set_charset($condb, "utf8");
/*
 * Check connection
 */ 
if(mysqli_connect_errno()) {
    error_log("Database connection failed: " . mysqli_connect_error());
    die("Failed to connect to MySQL: " . mysqli_connect_error());
}
?>