<?php
header('Content-Type: application/json');
error_reporting(E_ALL);
ini_set('display_errors', 1);

$base = '/home/kdsmf/earnperday.live';
$debug = [];

// backend folder ke andar kya hai
$debug['backend_files'] = scandir($base . '/backend');

// config folder check
if (is_dir($base . '/backend/config')) {
    $debug['backend_config_files'] = scandir($base . '/backend/config');
}

// Direct db file dhundo
$possibleDb = [
    $base . '/backend/db.php',
    $base . '/backend/config/db.php',
    $base . '/backend/includes/db.php',
    $base . '/backend/database/db.php',
    $base . '/config/db.php',
];

foreach ($possibleDb as $path) {
    $debug['path_check'][$path] = file_exists($path) ? 'FOUND ✅' : 'not found';
}

echo json_encode($debug, JSON_PRETTY_PRINT);
?>