Sindbad~EG File Manager
<?php
require_once 'includes/functions.php';
$eventId = $_GET['event'] ?? 1;
$db = new CopMadinaDB();
$conn = $db->getConnection();
echo "<h2>Clear Custom Event Form - Event ID: $eventId</h2>";
// Show current situation
$stmt = $conn->prepare("SELECT * FROM events WHERE id = ?");
$stmt->execute([$eventId]);
$event = $stmt->fetch();
echo "<h3>Current Event</h3>";
echo "Event: " . $event['title'] . "<br>";
echo "Form Template ID: " . ($event['form_template_id'] ?? 'NULL') . "<br>";
// Check custom form
$stmt = $conn->prepare("SELECT * FROM event_forms WHERE event_id = ?");
$stmt->execute([$eventId]);
$customForm = $stmt->fetch();
if ($customForm) {
echo "<h3>Custom Form Found</h3>";
$fields = json_decode($customForm['form_fields'], true);
echo "Custom form has " . count($fields) . " fields<br>";
if (isset($_POST['delete_custom'])) {
// Delete the custom form
$stmt = $conn->prepare("DELETE FROM event_forms WHERE event_id = ?");
$result = $stmt->execute([$eventId]);
if ($result) {
echo "✅ Custom event form deleted successfully!<br>";
echo "Now the template will be used instead.<br>";
echo '<a href="register.php?event=' . $eventId . '">Test Registration Form</a><br>';
} else {
echo "❌ Failed to delete custom form<br>";
}
} else {
echo '<form method="POST">';
echo '<input type="hidden" name="delete_custom" value="1">';
echo '<button type="submit" onclick="return confirm(\'Are you sure you want to delete the custom event form? This will make the event use the template instead.\')">Delete Custom Form</button>';
echo '</form>';
}
} else {
echo "<h3>No Custom Form</h3>";
echo "Event will use template form.<br>";
}
// Show template details
if (!empty($event['form_template_id'])) {
$stmt = $conn->prepare("SELECT * FROM event_form_templates WHERE id = ?");
$stmt->execute([$event['form_template_id']]);
$template = $stmt->fetch();
if ($template) {
echo "<h3>Template Details</h3>";
echo "Template: " . $template['name'] . "<br>";
$templateFields = json_decode($template['form_fields'], true);
echo "Template has " . count($templateFields) . " fields<br>";
}
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists