Sindbad~EG File Manager
<?php
require_once 'config/config.php';
require_once 'classes/EventManager.php';
$pageTitle = "Check Registration Status - " . APP_NAME;
$db = Database::getInstance()->getConnection();
$eventManager = new EventManager();
$trackingCode = $_GET['tracking_code'] ?? '';
$registration = null;
$trackingData = null;
if ($trackingCode) {
// Get registration data
$registration = $eventManager->getRegistrationByTrackingCode($trackingCode);
// Get tracking code data from memberuser_codes table
$stmt = $db->prepare("
SELECT muc.*, m.first_name as member_first_name, m.last_name as member_last_name,
m.phone as member_phone, m.email as member_email
FROM memberuser_codes muc
LEFT JOIN members m ON muc.member_id = m.id
WHERE muc.tracking_code = :tracking_code
");
$stmt->execute(['tracking_code' => $trackingCode]);
$trackingData = $stmt->fetch();
}
// Get settings for theme colors
$stmt = $db->query("SELECT * FROM general_settings ORDER BY id DESC LIMIT 1");
$settings = $stmt->fetch();
$settings = array_merge([
'site_title' => APP_NAME,
'theme_primary_color' => '#3B82F6',
'theme_secondary_color' => '#10B981'
], $settings ?: []);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $pageTitle; ?></title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary-color: <?php echo $settings['theme_primary_color']; ?>;
--secondary-color: <?php echo $settings['theme_secondary_color']; ?>;
}
.bg-primary { background-color: var(--primary-color); }
.bg-secondary { background-color: var(--secondary-color); }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.border-primary { border-color: var(--primary-color); }
</style>
</head>
<body class="bg-gray-50">
<!-- Header -->
<header class="bg-primary shadow-lg">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between h-16">
<div class="flex items-center space-x-3">
<a href="<?php echo BASE_URL; ?>" class="flex items-center space-x-2">
<i class="fas fa-church text-2xl text-white"></i>
<span class="text-white font-bold text-lg"><?php echo htmlspecialchars($settings['site_title']); ?></span>
</a>
</div>
<div class="flex items-center space-x-4">
<a href="conference.php" class="text-white hover:text-gray-200 transition">
<i class="fas fa-calendar mr-1"></i>Events
</a>
<a href="login.php" class="text-white hover:text-gray-200 transition">
<i class="fas fa-sign-in-alt mr-1"></i>Login
</a>
</div>
</div>
</div>
</header>
<div class="container mx-auto px-4 py-8">
<div class="max-w-4xl mx-auto">
<div class="text-center mb-8">
<h1 class="text-3xl font-bold text-gray-800 mb-4">
<i class="fas fa-search mr-2 text-primary"></i>Status Checker
</h1>
<p class="text-gray-600">Check your registration or event status</p>
</div>
<!-- Option Selector -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<!-- Registration Status -->
<div class="bg-white rounded-xl shadow-lg p-6 cursor-pointer hover:shadow-xl transition" onclick="showSection('registration')">
<div class="text-center">
<div class="w-16 h-16 rounded-full mx-auto mb-4 flex items-center justify-center" style="background: linear-gradient(135deg, #1E40AF 0%, #9333EA 100%);">
<i class="fas fa-ticket-alt text-white text-2xl"></i>
</div>
<h3 class="text-xl font-bold text-gray-800 mb-2">Registration Status</h3>
<p class="text-gray-600 text-sm">Check your event registration details</p>
</div>
</div>
<!-- Event Status -->
<div class="bg-white rounded-xl shadow-lg p-6 cursor-pointer hover:shadow-xl transition" onclick="showSection('event')">
<div class="text-center">
<div class="w-16 h-16 rounded-full mx-auto mb-4 flex items-center justify-center" style="background: linear-gradient(135deg, #F97316 0%, #FBBF24 100%);">
<i class="fas fa-calendar-check text-white text-2xl"></i>
</div>
<h3 class="text-xl font-bold text-gray-800 mb-2">Event Status</h3>
<p class="text-gray-600 text-sm">Check event details and status</p>
</div>
</div>
</div>
<!-- Registration Check Section -->
<div id="registrationSection" class="search-section">
<div class="bg-white rounded-xl shadow-lg p-6 mb-8">
<h3 class="text-lg font-bold text-gray-800 mb-4">
<i class="fas fa-ticket-alt mr-2 text-blue-500"></i>Check Registration Status
</h3>
<form method="GET" class="flex flex-col sm:flex-row gap-4">
<input type="text" name="tracking_code" value="<?php echo htmlspecialchars($trackingCode); ?>"
placeholder="Enter tracking code (e.g., EVT2025ABC123)"
class="flex-1 px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent"
id="trackingInput"
required>
<button type="submit" class="bg-primary text-white px-6 py-3 rounded-lg hover:opacity-90 transition">
<i class="fas fa-search mr-2"></i>Check Status
</button>
</form>
<p class="text-xs text-gray-500 mt-3">
<i class="fas fa-info-circle mr-1"></i>Enter your registration tracking code to view details
</p>
</div>
</div>
<!-- Event Status Check Section -->
<div id="eventSection" class="search-section" style="display: none;">
<div class="bg-white rounded-xl shadow-lg p-6 mb-8">
<h3 class="text-lg font-bold text-gray-800 mb-4">
<i class="fas fa-calendar-check mr-2 text-orange-500"></i>Check Event Status
</h3>
<!-- QR Scanner -->
<div class="mb-6 p-4 bg-gradient-to-r from-orange-50 to-yellow-50 rounded-lg border-2 border-orange-200">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center">
<i class="fas fa-qrcode text-orange-500 text-2xl mr-3"></i>
<div>
<p class="font-semibold text-gray-800">QR Code Scanner</p>
<p class="text-sm text-gray-600">Scan event QR code or enter event code manually</p>
</div>
</div>
<span class="px-3 py-1 bg-green-100 text-green-700 text-xs font-bold rounded-full">Ready</span>
</div>
<input type="text"
id="eventCodeInput"
placeholder="Focus here and scan QR code or type event code..."
class="w-full px-4 py-3 border-2 border-orange-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-orange-500 font-mono">
<p class="text-xs text-gray-500 mt-2">
<i class="fas fa-info-circle mr-1"></i>Click in the field above, then scan event QR code or type event ID/code
</p>
</div>
<!-- Manual Event Selection -->
<div class="text-center">
<p class="text-gray-600 mb-4">Or browse all events</p>
<a href="event-status.php" class="inline-block bg-gradient-to-r from-orange-500 to-yellow-500 text-white px-6 py-3 rounded-lg hover:shadow-lg transition">
<i class="fas fa-list mr-2"></i>View All Events
</a>
</div>
</div>
</div>
<?php if ($trackingCode && !$registration && !$trackingData): ?>
<!-- Not Found -->
<div class="bg-white rounded-xl shadow-lg p-8 text-center">
<div class="text-red-500 mb-4">
<i class="fas fa-exclamation-triangle text-4xl"></i>
</div>
<h3 class="text-xl font-semibold text-gray-800 mb-2">Tracking Code Not Found</h3>
<p class="text-gray-600 mb-4">The tracking code "<?php echo htmlspecialchars($trackingCode); ?>" was not found in our system.</p>
<p class="text-sm text-gray-500">Please check your tracking code and try again, or contact support if you believe this is an error.</p>
</div>
<?php elseif ($registration || $trackingData): ?>
<!-- Registration Details -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- Header -->
<div class="bg-gradient-to-r from-green-500 to-blue-500 text-white p-6">
<div class="flex items-center justify-between">
<div>
<h3 class="text-xl font-bold">Registration Found</h3>
<p class="opacity-90">Tracking Code: <?php echo htmlspecialchars($trackingCode); ?></p>
</div>
<div class="text-right">
<?php if ($registration): ?>
<?php
$statusColors = [
'pending' => 'bg-yellow-500',
'confirmed' => 'bg-green-500',
'attended' => 'bg-blue-500',
'cancelled' => 'bg-red-500'
];
$statusIcons = [
'pending' => 'clock',
'confirmed' => 'check-circle',
'attended' => 'user-check',
'cancelled' => 'times-circle'
];
?>
<div class="<?php echo $statusColors[$registration['status']] ?? 'bg-gray-500'; ?> px-4 py-2 rounded-full">
<i class="fas fa-<?php echo $statusIcons[$registration['status']] ?? 'question'; ?> mr-2"></i>
<?php echo ucfirst($registration['status']); ?>
</div>
<?php else: ?>
<div class="bg-blue-500 px-4 py-2 rounded-full">
<i class="fas fa-info-circle mr-2"></i>Active
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Content -->
<div class="p-6">
<?php if ($registration): ?>
<!-- Event Registration Details -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<h4 class="font-semibold text-gray-800 mb-3">Personal Information</h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-600">Name:</span>
<span class="font-medium"><?php echo htmlspecialchars($registration['first_name'] . ' ' . $registration['last_name']); ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Email:</span>
<span class="font-medium"><?php echo htmlspecialchars($registration['email']); ?></span>
</div>
<?php if ($registration['phone']): ?>
<div class="flex justify-between">
<span class="text-gray-600">Phone:</span>
<span class="font-medium"><?php echo htmlspecialchars($registration['phone']); ?></span>
</div>
<?php endif; ?>
<div class="flex justify-between">
<span class="text-gray-600">Type:</span>
<span class="px-2 py-1 text-xs rounded-full <?php echo $registration['registration_type'] === 'member' ? 'bg-blue-100 text-blue-800' : 'bg-gray-100 text-gray-800'; ?>">
<?php echo ucfirst($registration['registration_type']); ?>
</span>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-gray-800 mb-3">Event Information</h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-600">Event:</span>
<span class="font-medium"><?php echo htmlspecialchars($registration['event_name']); ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Date:</span>
<span class="font-medium"><?php echo date('F j, Y', strtotime($registration['start_date'])); ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Time:</span>
<span class="font-medium"><?php echo date('g:i A', strtotime($registration['start_date'])); ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Location:</span>
<span class="font-medium"><?php echo ucfirst($registration['location_type']); ?></span>
</div>
</div>
</div>
</div>
<!-- Registration Timeline -->
<div class="border-t pt-6">
<h4 class="font-semibold text-gray-800 mb-4">Registration Timeline</h4>
<div class="space-y-3">
<div class="flex items-center">
<div class="w-3 h-3 bg-green-500 rounded-full mr-3"></div>
<div class="flex-1">
<span class="text-sm font-medium">Registered</span>
<span class="text-xs text-gray-500 ml-2"><?php echo date('M j, Y H:i', strtotime($registration['registered_at'])); ?></span>
</div>
</div>
<?php if ($registration['confirmed_at']): ?>
<div class="flex items-center">
<div class="w-3 h-3 bg-blue-500 rounded-full mr-3"></div>
<div class="flex-1">
<span class="text-sm font-medium">Confirmed</span>
<span class="text-xs text-gray-500 ml-2"><?php echo date('M j, Y H:i', strtotime($registration['confirmed_at'])); ?></span>
</div>
</div>
<?php endif; ?>
<?php if ($registration['attended_at']): ?>
<div class="flex items-center">
<div class="w-3 h-3 bg-purple-500 rounded-full mr-3"></div>
<div class="flex-1">
<span class="text-sm font-medium">Attended</span>
<span class="text-xs text-gray-500 ml-2"><?php echo date('M j, Y H:i', strtotime($registration['attended_at'])); ?></span>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php elseif ($trackingData): ?>
<!-- General Tracking Code Details -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h4 class="font-semibold text-gray-800 mb-3">Code Information</h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-600">Code:</span>
<span class="font-medium"><?php echo htmlspecialchars($trackingData['code']); ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Type:</span>
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">
<?php echo ucfirst($trackingData['code_type']); ?>
</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Usage:</span>
<span class="font-medium"><?php echo $trackingData['usage_count']; ?><?php echo $trackingData['max_usage'] ? '/' . $trackingData['max_usage'] : ''; ?></span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Created:</span>
<span class="font-medium"><?php echo date('M j, Y', strtotime($trackingData['created_at'])); ?></span>
</div>
</div>
</div>
<?php if ($trackingData['member_first_name']): ?>
<div>
<h4 class="font-semibold text-gray-800 mb-3">Member Information</h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-600">Name:</span>
<span class="font-medium"><?php echo htmlspecialchars($trackingData['member_first_name'] . ' ' . $trackingData['member_last_name']); ?></span>
</div>
<?php if ($trackingData['member_email']): ?>
<div class="flex justify-between">
<span class="text-gray-600">Email:</span>
<span class="font-medium"><?php echo htmlspecialchars($trackingData['member_email']); ?></span>
</div>
<?php endif; ?>
<?php if ($trackingData['member_phone']): ?>
<div class="flex justify-between">
<span class="text-gray-600">Phone:</span>
<span class="font-medium"><?php echo htmlspecialchars($trackingData['member_phone']); ?></span>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php if ($trackingData['description']): ?>
<div class="border-t pt-6 mt-6">
<h4 class="font-semibold text-gray-800 mb-2">Description</h4>
<p class="text-gray-600"><?php echo htmlspecialchars($trackingData['description']); ?></p>
</div>
<?php endif; ?>
<?php endif; ?>
<!-- Actions -->
<div class="border-t pt-6 mt-6 text-center">
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<a href="conference.php" class="bg-primary text-white px-6 py-2 rounded-lg hover:opacity-90 transition">
<i class="fas fa-calendar mr-2"></i>View More Events
</a>
<button onclick="window.print()" class="bg-gray-500 text-white px-6 py-2 rounded-lg hover:bg-gray-600 transition">
<i class="fas fa-print mr-2"></i>Print Details
</button>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<script>
// Toggle between sections
function showSection(section) {
const registrationSection = document.getElementById('registrationSection');
const eventSection = document.getElementById('eventSection');
if (section === 'registration') {
registrationSection.style.display = 'block';
eventSection.style.display = 'none';
document.getElementById('trackingInput').focus();
} else if (section === 'event') {
registrationSection.style.display = 'none';
eventSection.style.display = 'block';
document.getElementById('eventCodeInput').focus();
}
}
// QR Scanner for Event Code
const eventCodeInput = document.getElementById('eventCodeInput');
let scanBuffer = '';
let scanTimeout = null;
if (eventCodeInput) {
eventCodeInput.addEventListener('input', function(e) {
clearTimeout(scanTimeout);
scanTimeout = setTimeout(() => {
const eventCode = eventCodeInput.value.trim();
if (eventCode) {
// Check if it's a numeric event ID or code
if (/^\d+$/.test(eventCode)) {
// Redirect to event status page with event ID
window.location.href = 'event-status.php?event_id=' + eventCode;
} else {
// Redirect with event code
window.location.href = 'event-status.php?event_code=' + encodeURIComponent(eventCode);
}
}
}, 500); // Wait 500ms after last input
});
// Handle barcode scanner input (usually ends with Enter)
eventCodeInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
const eventCode = eventCodeInput.value.trim();
if (eventCode) {
if (/^\d+$/.test(eventCode)) {
window.location.href = 'event-status.php?event_id=' + eventCode;
} else {
window.location.href = 'event-status.php?event_code=' + encodeURIComponent(eventCode);
}
}
}
});
}
// Show registration section by default if tracking code is present
<?php if ($trackingCode): ?>
showSection('registration');
<?php endif; ?>
</script>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists