Sindbad~EG File Manager
<?php
require_once 'includes/functions.php';
$db = new CopMadinaDB();
$conn = $db->getConnection();
echo "<h2>Applying Schema Fixes</h2>";
// Read and execute the SQL file
$sqlFile = __DIR__ . '/fix_table_schemas.sql';
if (file_exists($sqlFile)) {
$sql = file_get_contents($sqlFile);
$statements = explode(';', $sql);
foreach ($statements as $statement) {
$statement = trim($statement);
if (!empty($statement) && !str_starts_with($statement, '--')) {
try {
$conn->exec($statement);
echo "✅ Executed: " . substr($statement, 0, 50) . "...<br>";
} catch (Exception $e) {
// Check if error is about column already existing
if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
echo "⚠️ Column already exists: " . substr($statement, 0, 50) . "...<br>";
} else {
echo "❌ Error: " . $e->getMessage() . "<br>";
echo "Statement: " . $statement . "<br><br>";
}
}
}
}
echo "<br><h3>Schema fixes completed!</h3>";
} else {
echo "❌ SQL file not found: " . $sqlFile;
}
echo "<br><a href='debug_table_structure.php'>Check Updated Table Structures</a>";
echo "<br><a href='admin/areas.php'>Test Areas Admin</a>";
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists