Sindbad~EG File Manager
<?php
require_once 'config/config.php';
checkLogin();
if (!isSuperuser()) die('Access denied');
$db = Database::getInstance()->getConnection();
// Get Administration module
$admin = $db->query("SELECT * FROM module_management WHERE module_name = 'Administration'")->fetch();
echo "<!DOCTYPE html><html><head><title>Check Links</title><script src='https://cdn.tailwindcss.com'></script></head><body class='bg-gray-100 p-8'>";
echo "<div class='max-w-4xl mx-auto bg-white rounded-lg shadow p-6'>";
echo "<h1 class='text-2xl font-bold mb-4'>Checking Administration Module Links</h1>";
if ($admin) {
echo "<div class='bg-blue-50 p-4 rounded mb-4'>";
echo "<strong>Administration Module ID:</strong> " . $admin['id'] . "<br>";
echo "<strong>Module Name:</strong> " . $admin['module_name'];
echo "</div>";
// Check if there are access levels for this module
$stmt = $db->prepare("SELECT * FROM module_access_levels WHERE module_id = ?");
$stmt->execute([$admin['id']]);
$accessLevels = $stmt->fetchAll();
echo "<div class='bg-green-50 p-4 rounded mb-4'>";
echo "<strong>Access Level Records Found:</strong> " . count($accessLevels) . "<br><br>";
if (count($accessLevels) > 0) {
echo "<table class='w-full border'>";
echo "<tr class='bg-gray-200'><th class='p-2 border'>Access Level</th><th class='p-2 border'>Is Enabled</th></tr>";
foreach ($accessLevels as $al) {
echo "<tr><td class='p-2 border'>" . $al['access_level'] . "</td><td class='p-2 border'>" . ($al['is_enabled'] ? '✅ YES (1)' : '❌ NO (0)') . "</td></tr>";
}
echo "</table>";
} else {
echo "<p class='text-red-600 font-bold'>❌ NO ACCESS LEVEL RECORDS FOUND!</p>";
echo "<p class='mt-2'>This is the problem! The module_access_levels table has no records for Administration.</p>";
}
echo "</div>";
// Now test the actual query used in the main page
echo "<div class='bg-yellow-50 p-4 rounded mb-4'>";
echo "<strong>Testing Main Page Query:</strong><br><br>";
$testQuery = "
SELECT
m.id,
m.module_name,
GROUP_CONCAT(
CONCAT(mal.access_level, ':', IF(mal.is_enabled, '1', '0'))
ORDER BY FIELD(mal.access_level, 'assembly', 'district', 'area', 'superuser')
SEPARATOR '|'
) as access_config
FROM module_management m
LEFT JOIN module_access_levels mal ON m.id = mal.module_id
WHERE m.module_name = 'Administration'
GROUP BY m.id
";
$result = $db->query($testQuery)->fetch();
echo "<strong>access_config result:</strong> " . ($result['access_config'] ?? 'NULL') . "<br>";
echo "</div>";
} else {
echo "<p class='text-red-600'>Administration module not found!</p>";
}
// Check total records in module_access_levels
$total = $db->query("SELECT COUNT(*) FROM module_access_levels")->fetchColumn();
echo "<div class='bg-purple-50 p-4 rounded'>";
echo "<strong>Total records in module_access_levels table:</strong> " . $total;
echo "</div>";
echo "</div></body></html>";
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists