Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/conference/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/conference/check-registration.php

<?php
require_once 'includes/functions.php';

$db = new CopMadinaDB();
$conn = $db->getConnection();

$registration = null;
$error = '';
$registrationCode = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $registrationCode = sanitizeInput($_POST['registration_code'] ?? '');
    
    if (empty($registrationCode)) {
        $error = 'Please enter your registration code.';
    } else {
        // Search for registration in both member and non-member registrations
        $stmt = $conn->prepare("
            SELECT 
                nr.id,
                nr.registration_code,
                nr.first_name,
                nr.last_name,
                nr.email,
                nr.phone,
                nr.registration_date,
                nr.payment_status,
                nr.total_amount,
                e.title as event_title,
                e.start_date,
                e.end_date,
                e.location,
                e.description,
                a.name as area_name,
                d.name as district_name,
                ass.name as assembly_name,
                'non-member' as registration_type
            FROM non_member_registrations nr
            JOIN events e ON nr.event_id = e.id
            LEFT JOIN areas a ON e.area_id = a.id
            LEFT JOIN districts d ON e.district_id = d.id
            LEFT JOIN assemblies ass ON e.assembly_id = ass.id
            WHERE nr.registration_code = ?
            
            UNION ALL
            
            SELECT 
                r.id,
                r.registration_code,
                u.first_name,
                u.last_name,
                u.email,
                u.phone,
                r.registration_date,
                r.payment_status,
                r.total_amount,
                e.title as event_title,
                e.start_date,
                e.end_date,
                e.location,
                e.description,
                a.name as area_name,
                d.name as district_name,
                ass.name as assembly_name,
                'member' as registration_type
            FROM registrations r
            JOIN users u ON r.user_id = u.id
            JOIN events e ON r.event_id = e.id
            LEFT JOIN areas a ON e.area_id = a.id
            LEFT JOIN districts d ON e.district_id = d.id
            LEFT JOIN assemblies ass ON e.assembly_id = ass.id
            WHERE r.registration_code = ?
            
            ORDER BY registration_date DESC
        ");
        
        $stmt->execute([$registrationCode, $registrationCode]);
        $registration = $stmt->fetch();
        
        if (!$registration) {
            $error = 'Registration code not found. Please check your code and try again.';
        }
    }
}

$settings = getSettings();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Check Registration Status - COP Madina Conference Management</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#eff6ff',
                            100: '#dbeafe',
                            500: '#3b82f6',
                            600: '#2563eb',
                            700: '#1d4ed8',
                            800: '#1e40af',
                            900: '#1e3a8a'
                        }
                    }
                }
            }
        }
    </script>
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .status-confirmed {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        }
        .status-pending {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
        }
        .status-cancelled {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <!-- Header -->
    <header class="bg-white shadow-sm border-b border-gray-200">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between items-center h-16">
                <div class="flex items-center">
                    <a href="<?php echo BASE_URL; ?>" class="flex items-center">
                        <img src="<?php echo BASE_URL; ?>assets/images/logo.png" alt="COP Madina" class="h-10 w-10 rounded-full mr-3">
                        <div>
                            <h1 class="text-xl font-bold text-gray-900">COP Madina</h1>
                            <p class="text-xs text-gray-500">Conference Management</p>
                        </div>
                    </a>
                </div>
                
                <nav class="flex items-center space-x-6">
                    <a href="<?php echo BASE_URL; ?>" class="text-gray-600 hover:text-gray-900 transition-colors">
                        <i class="fas fa-home mr-1"></i>Home
                    </a>
                    <a href="<?php echo BASE_URL; ?>login.php" class="text-gray-600 hover:text-gray-900 transition-colors">
                        <i class="fas fa-sign-in-alt mr-1"></i>Login
                    </a>
                    <a href="<?php echo BASE_URL; ?>register-member.php" class="bg-primary-600 text-white px-4 py-2 rounded-lg hover:bg-primary-700 transition-colors">
                        <i class="fas fa-user-plus mr-1"></i>Join Us
                    </a>
                </nav>
            </div>
        </div>
    </header>

    <div id="app" class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Page Header -->
        <div class="text-center mb-12">
            <div class="gradient-bg text-white rounded-2xl p-8 mb-8">
                <i class="fas fa-search text-4xl mb-4"></i>
                <h1 class="text-3xl font-bold mb-2">Check Registration Status</h1>
                <p class="text-lg opacity-90">Enter your registration code to view your event registration details</p>
            </div>
        </div>

        <!-- Search Form -->
        <div class="bg-white rounded-xl shadow-lg p-8 mb-8">
            <form method="POST" class="max-w-md mx-auto">
                <div class="mb-6">
                    <label for="registration_code" class="block text-sm font-medium text-gray-700 mb-2">
                        Registration Code
                    </label>
                    <div class="relative">
                        <input type="text" 
                               id="registration_code" 
                               name="registration_code" 
                               value="<?php echo htmlspecialchars($registrationCode); ?>"
                               placeholder="Enter your registration code (e.g., REG-2024-XXXXX)"
                               class="block w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 text-center font-mono text-lg"
                               required>
                        <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                            <i class="fas fa-ticket-alt text-gray-400"></i>
                        </div>
                    </div>
                    <p class="text-sm text-gray-500 mt-2">
                        <i class="fas fa-info-circle mr-1"></i>
                        Your registration code was provided when you registered for the event
                    </p>
                </div>

                <?php if ($error): ?>
                <div class="mb-4 bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg">
                    <div class="flex items-center">
                        <i class="fas fa-exclamation-circle mr-2"></i>
                        <?php echo htmlspecialchars($error); ?>
                    </div>
                </div>
                <?php endif; ?>

                <button type="submit" 
                        class="w-full gradient-bg text-white py-3 px-6 rounded-lg hover:opacity-90 transition-all duration-200 font-medium">
                    <i class="fas fa-search mr-2"></i>
                    Check Registration Status
                </button>
            </form>
        </div>

        <!-- Registration Details -->
        <?php if ($registration): ?>
        <div class="bg-white rounded-xl shadow-lg overflow-hidden">
            <!-- Status Header -->
            <div class="<?php 
                echo $registration['payment_status'] === 'paid' ? 'status-confirmed' : 
                    ($registration['payment_status'] === 'pending' ? 'status-pending' : 'status-cancelled'); 
            ?> text-white p-6">
                <div class="flex items-center justify-between">
                    <div>
                        <h2 class="text-2xl font-bold mb-2">Registration Found!</h2>
                        <p class="text-lg opacity-90">
                            Status: 
                            <?php if ($registration['payment_status'] === 'paid'): ?>
                                <span class="font-semibold">Confirmed</span>
                                <i class="fas fa-check-circle ml-1"></i>
                            <?php elseif ($registration['payment_status'] === 'pending'): ?>
                                <span class="font-semibold">Pending Payment</span>
                                <i class="fas fa-clock ml-1"></i>
                            <?php else: ?>
                                <span class="font-semibold">Cancelled</span>
                                <i class="fas fa-times-circle ml-1"></i>
                            <?php endif; ?>
                        </p>
                    </div>
                    <div class="text-right">
                        <div class="text-3xl font-mono font-bold"><?php echo htmlspecialchars($registration['registration_code']); ?></div>
                        <div class="text-sm opacity-75 capitalize"><?php echo $registration['registration_type']; ?> Registration</div>
                    </div>
                </div>
            </div>

            <div class="p-6">
                <!-- Personal Information -->
                <div class="grid md:grid-cols-2 gap-8 mb-8">
                    <div>
                        <h3 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                            <i class="fas fa-user text-primary-600 mr-2"></i>
                            Personal Information
                        </h3>
                        <div class="space-y-3">
                            <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">Registration Date:</span>
                                <span class="font-medium"><?php echo date('M j, Y g:i A', strtotime($registration['registration_date'])); ?></span>
                            </div>
                        </div>
                    </div>

                    <div>
                        <h3 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                            <i class="fas fa-credit-card text-primary-600 mr-2"></i>
                            Payment Information
                        </h3>
                        <div class="space-y-3">
                            <div class="flex justify-between">
                                <span class="text-gray-600">Total Amount:</span>
                                <span class="font-bold text-lg">
                                    <?php if ($registration['total_amount'] > 0): ?>
                                        GH₵ <?php echo number_format($registration['total_amount'], 2); ?>
                                    <?php else: ?>
                                        <span class="text-green-600">FREE</span>
                                    <?php endif; ?>
                                </span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">Payment Status:</span>
                                <span class="font-medium <?php 
                                    echo $registration['payment_status'] === 'paid' ? 'text-green-600' : 
                                        ($registration['payment_status'] === 'pending' ? 'text-yellow-600' : 'text-red-600'); 
                                ?>">
                                    <?php echo ucfirst($registration['payment_status']); ?>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Event Information -->
                <div class="border-t border-gray-200 pt-6">
                    <h3 class="text-lg font-semibold text-gray-900 mb-4 flex items-center">
                        <i class="fas fa-calendar-alt text-primary-600 mr-2"></i>
                        Event Details
                    </h3>
                    
                    <div class="bg-gray-50 rounded-lg p-6">
                        <h4 class="text-xl font-bold text-gray-900 mb-2"><?php echo htmlspecialchars($registration['event_title']); ?></h4>
                        
                        <div class="grid md:grid-cols-2 gap-6 mb-4">
                            <div>
                                <div class="flex items-center text-gray-600 mb-2">
                                    <i class="fas fa-clock mr-2"></i>
                                    <span class="font-medium">Event Date & Time</span>
                                </div>
                                <p class="text-gray-900">
                                    <?php echo date('l, F j, Y', strtotime($registration['start_date'])); ?>
                                    <br>
                                    <?php echo date('g:i A', strtotime($registration['start_date'])); ?>
                                    <?php if ($registration['end_date']): ?>
                                        - <?php echo date('g:i A', strtotime($registration['end_date'])); ?>
                                    <?php endif; ?>
                                </p>
                            </div>
                            
                            <?php if ($registration['location']): ?>
                            <div>
                                <div class="flex items-center text-gray-600 mb-2">
                                    <i class="fas fa-map-marker-alt mr-2"></i>
                                    <span class="font-medium">Location</span>
                                </div>
                                <p class="text-gray-900"><?php echo htmlspecialchars($registration['location']); ?></p>
                            </div>
                            <?php endif; ?>
                        </div>

                        <div class="mb-4">
                            <div class="flex items-center text-gray-600 mb-2">
                                <i class="fas fa-church mr-2"></i>
                                <span class="font-medium">Organizing Body</span>
                            </div>
                            <p class="text-gray-900">
                                <?php 
                                if ($registration['assembly_name']) {
                                    echo htmlspecialchars($registration['assembly_name'] . ' Assembly');
                                } elseif ($registration['district_name']) {
                                    echo htmlspecialchars($registration['district_name'] . ' District');
                                } elseif ($registration['area_name']) {
                                    echo htmlspecialchars($registration['area_name'] . ' Area');
                                } else {
                                    echo 'The Church of Pentecost - Madina Area';
                                }
                                ?>
                            </p>
                        </div>

                        <?php if ($registration['description']): ?>
                        <div>
                            <div class="flex items-center text-gray-600 mb-2">
                                <i class="fas fa-info-circle mr-2"></i>
                                <span class="font-medium">Description</span>
                            </div>
                            <p class="text-gray-700"><?php echo nl2br(htmlspecialchars($registration['description'])); ?></p>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Action Buttons -->
                <div class="border-t border-gray-200 pt-6 mt-6">
                    <div class="flex flex-wrap gap-4 justify-center">
                        <?php if ($registration['payment_status'] === 'pending' && $registration['total_amount'] > 0): ?>
                        <button class="bg-green-600 text-white px-6 py-3 rounded-lg hover:bg-green-700 transition-colors">
                            <i class="fas fa-credit-card mr-2"></i>
                            Complete Payment
                        </button>
                        <?php endif; ?>
                        
                        <button onclick="window.print()" class="bg-primary-600 text-white px-6 py-3 rounded-lg hover:bg-primary-700 transition-colors">
                            <i class="fas fa-print mr-2"></i>
                            Print Details
                        </button>
                        
                        <a href="<?php echo BASE_URL; ?>event.php?id=<?php echo $registration['id']; ?>" 
                           class="bg-gray-600 text-white px-6 py-3 rounded-lg hover:bg-gray-700 transition-colors">
                            <i class="fas fa-eye mr-2"></i>
                            View Event
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <?php endif; ?>

        <!-- Help Section -->
        <div class="mt-12 bg-blue-50 border border-blue-200 rounded-xl p-6">
            <h3 class="text-lg font-semibold text-blue-900 mb-4 flex items-center">
                <i class="fas fa-question-circle text-blue-600 mr-2"></i>
                Need Help?
            </h3>
            <div class="grid md:grid-cols-2 gap-6 text-blue-800">
                <div>
                    <h4 class="font-medium mb-2">Can't find your registration code?</h4>
                    <p class="text-sm">Check your email confirmation or contact the event organizer for assistance.</p>
                </div>
                <div>
                    <h4 class="font-medium mb-2">Payment Issues?</h4>
                    <p class="text-sm">Contact our support team for help with payment-related queries.</p>
                </div>
            </div>
            <div class="mt-4 pt-4 border-t border-blue-200">
                <div class="flex flex-wrap gap-4 text-sm">
                    <a href="mailto:support@copmadinaconf.org" class="text-blue-600 hover:text-blue-800">
                        <i class="fas fa-envelope mr-1"></i>Email Support
                    </a>
                    <a href="tel:+233123456789" class="text-blue-600 hover:text-blue-800">
                        <i class="fas fa-phone mr-1"></i>Call Support
                    </a>
                    <a href="<?php echo BASE_URL; ?>help.php" class="text-blue-600 hover:text-blue-800">
                        <i class="fas fa-book mr-1"></i>Help Center
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-800 text-white mt-16">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
            <div class="grid md:grid-cols-4 gap-8">
                <div class="md:col-span-2">
                    <div class="flex items-center mb-4">
                        <img src="<?php echo BASE_URL; ?>assets/images/logo.png" alt="COP Madina" class="h-10 w-10 rounded-full mr-3">
                        <div>
                            <h3 class="text-lg font-bold">COP Madina Conference Management</h3>
                            <p class="text-gray-400 text-sm">The Church of Pentecost - Madina Area</p>
                        </div>
                    </div>
                    <p class="text-gray-300 mb-4">
                        Connecting our community through events and conferences. 
                        Join us as we grow together in faith and fellowship.
                    </p>
                </div>
                
                <div>
                    <h4 class="text-lg font-semibold mb-4">Quick Links</h4>
                    <ul class="space-y-2 text-gray-300">
                        <li><a href="<?php echo BASE_URL; ?>" class="hover:text-white transition-colors">Home</a></li>
                        <li><a href="<?php echo BASE_URL; ?>district.php" class="hover:text-white transition-colors">District Events</a></li>
                        <li><a href="<?php echo BASE_URL; ?>assembly.php" class="hover:text-white transition-colors">Assembly Events</a></li>
                        <li><a href="<?php echo BASE_URL; ?>register-member.php" class="hover:text-white transition-colors">Join Us</a></li>
                    </ul>
                </div>
                
                <div>
                    <h4 class="text-lg font-semibold mb-4">Support</h4>
                    <ul class="space-y-2 text-gray-300">
                        <li><a href="<?php echo BASE_URL; ?>check-registration.php" class="hover:text-white transition-colors">Check Registration</a></li>
                        <li><a href="<?php echo BASE_URL; ?>contact.php" class="hover:text-white transition-colors">Contact Us</a></li>
                        <li><a href="<?php echo BASE_URL; ?>help.php" class="hover:text-white transition-colors">Help Center</a></li>
                        <li><a href="<?php echo BASE_URL; ?>privacy.php" class="hover:text-white transition-colors">Privacy Policy</a></li>
                    </ul>
                </div>
            </div>
            
            <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
                <p>&copy; <?php echo date('Y'); ?> The Church of Pentecost - Madina Area. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        const { createApp } = Vue;
        
        createApp({
            mounted() {
                // Auto-focus on registration code input
                const input = document.getElementById('registration_code');
                if (input && !input.value) {
                    input.focus();
                }
            }
        }).mount('#app');
    </script>
</body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists