<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/debug.log');

// Define base paths
define('BASE_PATH', dirname(dirname(__FILE__)));
define('PANEL_PATH', dirname(__FILE__));

// Include main config
require_once BASE_PATH . '/config.php';

// Additional Panel-specific settings
define('UPLOAD_PATH', BASE_PATH . '/upload/');
define('ASSETS_PATH', BASE_PATH . '/assets/');

// Create required directories if they don't exist
$required_dirs = array(
    UPLOAD_PATH,
    ASSETS_PATH,
    BASE_PATH . '/debug_logs/',
    BASE_PATH . '/plugins/'
);

foreach ($required_dirs as $dir) {
    if (!file_exists($dir)) {
        mkdir($dir, 0755, true);
    }
}

// Verify database connection
if (!isset($condb) || $condb->connect_error) {
    error_log("Database connection failed in Panel config");
    die("Database connection failed. Please check your configuration.");
}

// Database configuration
$db_host = 'localhost';
$db_user = 'root';
$db_pass = 'Cyberproduct123!@#';
$db_name = 'cyberbotnet';

// Create connection
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);

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

// Set charset to utf8mb4
$conn->set_charset("utf8mb4");
?> 