Sindbad~EG File Manager
<?php
/**
* Database Update Script
* Adds membership_cards table to existing installations
*/
require_once 'config/config.php';
$db = Database::getInstance()->getConnection();
try {
// Check if table exists
$stmt = $db->query("SHOW TABLES LIKE 'membership_cards'");
if ($stmt->rowCount() == 0) {
// Create table
$sql = file_get_contents(__DIR__ . '/database/membership_cards.sql');
$db->exec($sql);
echo "<h2>Success!</h2>";
echo "<p>Membership cards table created successfully.</p>";
// Add module to module_management if not exists
$stmt = $db->prepare("SELECT id FROM module_management WHERE module_url = 'modules/membership/cards.php'");
$stmt->execute();
if ($stmt->rowCount() == 0) {
$db->exec("
INSERT INTO module_management (module_name, module_description, module_icon, module_url, display_order, required_role, is_active)
VALUES ('Membership Cards', 'Generate and manage ID cards', 'id-card', 'modules/membership/cards.php', 3, 'viewer', TRUE)
");
echo "<p>Membership Cards module added to menu.</p>";
}
} else {
echo "<h2>Already Updated</h2>";
echo "<p>Membership cards table already exists.</p>";
}
echo "<br><a href='dashboard.php'>Go to Dashboard</a>";
} catch (PDOException $e) {
echo "<h2>Error</h2>";
echo "<p style='color: red;'>" . $e->getMessage() . "</p>";
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists