Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/conference/admin/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/conference/admin/settings.php

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

// Check if user is logged in and has admin privileges
if (!isLoggedIn()) {
    header('Location: ' . BASE_URL . 'login.php');
    exit();
}

$user = getCurrentUser();
if (!in_array($user['role'], ['superuser', 'area_admin', 'district_admin', 'assembly_admin'])) {
    header('Location: ' . BASE_URL . 'dashboard.php');
    exit();
}

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

// Handle form submissions
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = $_POST['action'] ?? '';
    
    if ($action === 'update_profile') {
        $first_name = trim($_POST['first_name']);
        $last_name = trim($_POST['last_name']);
        $email = trim($_POST['email']);
        $phone = trim($_POST['phone']);
        
        $update_query = "UPDATE users SET first_name = ?, last_name = ?, email = ?, phone = ? WHERE id = ?";
        $params = [$first_name, $last_name, $email, $phone, $user['id']];
        
        $stmt = executeQuery($update_query, $params);
        
        if ($stmt) {
            logAudit('update', 'users', $user['id']);
            addNotification('success', 'Profile updated successfully!');
        } else {
            addNotification('error', 'Failed to update profile.');
        }
    } elseif ($action === 'change_password') {
        $current_password = $_POST['current_password'];
        $new_password = $_POST['new_password'];
        $confirm_password = $_POST['confirm_password'];
        
        if ($new_password !== $confirm_password) {
            addNotification('error', 'New passwords do not match.');
        } elseif (!password_verify($current_password, $user['password'])) {
            addNotification('error', 'Current password is incorrect.');
        } else {
            $hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
            $stmt = executeQuery("UPDATE users SET password = ? WHERE id = ?", [$hashed_password, $user['id']]);
            
            if ($stmt) {
                logAudit('update', 'users', $user['id']);
                addNotification('success', 'Password changed successfully!');
            } else {
                addNotification('error', 'Failed to change password.');
            }
        }
    } elseif ($action === 'update_system_settings' && $user['role'] === 'superuser') {
        $site_name = trim($_POST['site_name']);
        $site_description = trim($_POST['site_description']);
        $contact_email = trim($_POST['contact_email']);
        $contact_phone = trim($_POST['contact_phone']);
        $timezone = trim($_POST['timezone']);
        $currency = trim($_POST['currency']);
        $email_notifications = isset($_POST['email_notifications']) ? '1' : '0';
        $sms_notifications = isset($_POST['sms_notifications']) ? '1' : '0';
        $auto_approve_registrations = isset($_POST['auto_approve_registrations']) ? '1' : '0';
        $maintenance_mode = isset($_POST['maintenance_mode']) ? '1' : '0';
        $maintenance_message = trim($_POST['maintenance_message']);
        $max_file_size = intval($_POST['max_file_size']);
        $allowed_file_types = trim($_POST['allowed_file_types']);
        $site_header_title = trim($_POST['site_header_title']);
        $site_header_subtitle = trim($_POST['site_header_subtitle']);
        $footer_text = trim($_POST['footer_text']);
        $footer_links = trim($_POST['footer_links']);
        $social_facebook = trim($_POST['social_facebook']);
        $social_twitter = trim($_POST['social_twitter']);
        $social_instagram = trim($_POST['social_instagram']);
        $social_youtube = trim($_POST['social_youtube']);
        
        // Handle logo upload
        $site_logo = $system_settings['site_logo'] ?? 'assets/images/logo.png';
        if (isset($_FILES['site_logo']) && $_FILES['site_logo']['error'] === UPLOAD_ERR_OK) {
            $upload_dir = '../assets/images/';
            $file_extension = strtolower(pathinfo($_FILES['site_logo']['name'], PATHINFO_EXTENSION));
            $allowed_extensions = ['jpg', 'jpeg', 'png', 'gif', 'svg'];
            
            if (in_array($file_extension, $allowed_extensions)) {
                $new_filename = 'logo_' . time() . '.' . $file_extension;
                $upload_path = $upload_dir . $new_filename;
                
                if (move_uploaded_file($_FILES['site_logo']['tmp_name'], $upload_path)) {
                    // Delete old logo if it's not the default
                    $old_logo = $system_settings['site_logo'] ?? '';
                    if ($old_logo && $old_logo !== 'assets/images/logo.png' && file_exists('../' . $old_logo)) {
                        unlink('../' . $old_logo);
                    }
                    $site_logo = 'assets/images/' . $new_filename;
                }
            }
        }
        
        // Update or insert system settings
        $settings = [
            'site_name' => $site_name,
            'site_description' => $site_description,
            'site_logo' => $site_logo,
            'contact_email' => $contact_email,
            'contact_phone' => $contact_phone,
            'timezone' => $timezone,
            'currency' => $currency,
            'email_notifications' => $email_notifications,
            'sms_notifications' => $sms_notifications,
            'auto_approve_registrations' => $auto_approve_registrations,
            'maintenance_mode' => $maintenance_mode,
            'maintenance_message' => $maintenance_message,
            'max_file_size' => $max_file_size,
            'allowed_file_types' => $allowed_file_types,
            'site_header_title' => $site_header_title,
            'site_header_subtitle' => $site_header_subtitle,
            'footer_text' => $footer_text,
            'footer_links' => $footer_links,
            'social_facebook' => $social_facebook,
            'social_twitter' => $social_twitter,
            'social_instagram' => $social_instagram,
            'social_youtube' => $social_youtube
        ];
        
        foreach ($settings as $key => $value) {
            $stmt = executeQuery(
                "INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = ?",
                [$key, $value, $value]
            );
        }
        
        logAudit('update', 'settings', 0, null, json_encode($settings), $user['id']);
        addNotification($user['id'], 'System Settings Updated', 'System settings have been updated successfully.', 'success');
    }
    
    header('Location: settings.php');
    exit();
}

// Get current system settings
$system_settings = [];
if ($user['role'] === 'superuser') {
    $stmt = executeQuery("SELECT setting_key, setting_value FROM settings");
    if ($stmt) {
        while ($row = $stmt->fetch()) {
            $system_settings[$row['setting_key']] = $row['setting_value'];
        }
    }
}

// Get user's current information
$stmt = executeQuery("SELECT * FROM users WHERE id = ?", [$user['id']]);
$current_user = $stmt ? $stmt->fetch() : $user;
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Settings - COP Madina Conference</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body class="bg-gradient-to-br from-slate-50 to-blue-50 min-h-screen">
    <div id="app" class="flex h-screen">
        <!-- Sidebar -->
        <?php include 'includes/admin_sidebar.php'; ?>
        
        <!-- Main Content -->
        <div class="flex-1 flex flex-col overflow-hidden ml-72">
            <!-- Header -->
            <header class="bg-white/80 backdrop-blur-sm shadow-lg border-b border-slate-200/50">
                <div class="flex items-center justify-between px-8 py-6">
                    <div>
                        <h1 class="text-3xl font-bold bg-gradient-to-r from-slate-600 to-gray-600 bg-clip-text text-transparent flex items-center">
                            <div class="p-2 rounded-xl bg-gradient-to-br from-slate-500 to-gray-600 mr-3">
                                <i class="fas fa-cog text-white"></i>
                            </div>
                            Settings
                        </h1>
                        <p class="text-slate-600 mt-1">Manage your account and system preferences</p>
                    </div>
                </div>
            </header>

            <!-- Content -->
            <main class="flex-1 overflow-y-auto p-8">
                <div class="max-w-4xl mx-auto space-y-8">
                    <!-- Profile Settings -->
                    <div class="bg-white/70 backdrop-blur-sm rounded-2xl shadow-lg border border-slate-200/50">
                        <div class="p-6 border-b border-slate-200/50">
                            <h3 class="text-lg font-semibold text-slate-800 flex items-center">
                                <i class="fas fa-user mr-3 text-slate-600"></i>
                                Profile Settings
                            </h3>
                        </div>
                        <form method="POST" class="p-6">
                            <input type="hidden" name="action" value="update_profile">
                            
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div>
                                    <label class="block text-sm font-semibold text-slate-700 mb-2">First Name</label>
                                    <input type="text" name="first_name" value="<?php echo htmlspecialchars($current_user['first_name']); ?>" required
                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                </div>
                                
                                <div>
                                    <label class="block text-sm font-semibold text-slate-700 mb-2">Last Name</label>
                                    <input type="text" name="last_name" value="<?php echo htmlspecialchars($current_user['last_name']); ?>" required
                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                </div>
                                
                                <div>
                                    <label class="block text-sm font-semibold text-slate-700 mb-2">Email</label>
                                    <input type="email" name="email" value="<?php echo htmlspecialchars($current_user['email']); ?>" required
                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                </div>
                                
                                <div>
                                    <label class="block text-sm font-semibold text-slate-700 mb-2">Phone</label>
                                    <input type="tel" name="phone" value="<?php echo htmlspecialchars($current_user['phone']); ?>"
                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                </div>
                            </div>
                            
                            <div class="flex justify-end mt-6">
                                <button type="submit" 
                                        class="px-6 py-3 bg-gradient-to-r from-slate-600 to-gray-600 hover:from-slate-700 hover:to-gray-700 text-white font-medium rounded-xl transition-all duration-200 shadow-lg">
                                    <i class="fas fa-save mr-2"></i>
                                    Update Profile
                                </button>
                            </div>
                        </form>
                    </div>

                    <!-- Password Settings -->
                    <div class="bg-white/70 backdrop-blur-sm rounded-2xl shadow-lg border border-slate-200/50">
                        <div class="p-6 border-b border-slate-200/50">
                            <h3 class="text-lg font-semibold text-slate-800 flex items-center">
                                <i class="fas fa-lock mr-3 text-slate-600"></i>
                                Change Password
                            </h3>
                        </div>
                        <form method="POST" class="p-6">
                            <input type="hidden" name="action" value="change_password">
                            
                            <div class="space-y-6">
                                <div>
                                    <label class="block text-sm font-semibold text-slate-700 mb-2">Current Password</label>
                                    <input type="password" name="current_password" required
                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                </div>
                                
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-2">New Password</label>
                                        <input type="password" name="new_password" required minlength="6"
                                               class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                    </div>
                                    
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-2">Confirm New Password</label>
                                        <input type="password" name="confirm_password" required minlength="6"
                                               class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                    </div>
                                </div>
                            </div>
                            
                            <div class="flex justify-end mt-6">
                                <button type="submit" 
                                        class="px-6 py-3 bg-gradient-to-r from-red-600 to-pink-600 hover:from-red-700 hover:to-pink-700 text-white font-medium rounded-xl transition-all duration-200 shadow-lg">
                                    <i class="fas fa-key mr-2"></i>
                                    Change Password
                                </button>
                            </div>
                        </form>
                    </div>

                    <!-- System Settings (Superuser Only) -->
                    <?php if ($user['role'] === 'superuser'): ?>
                    <div class="bg-white/70 backdrop-blur-sm rounded-2xl shadow-lg border border-slate-200/50">
                        <div class="p-6 border-b border-slate-200/50">
                            <h3 class="text-lg font-semibold text-slate-800 flex items-center">
                                <i class="fas fa-globe mr-3 text-slate-600"></i>
                                System Settings
                            </h3>
                            <p class="text-sm text-slate-600 mt-1">Configure global system preferences</p>
                        </div>
                        <form method="POST" enctype="multipart/form-data" class="p-6">
                            <input type="hidden" name="action" value="update_system_settings">
                            
                            <div class="space-y-8">
                                <!-- Basic Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-info-circle mr-2 text-blue-500"></i>
                                        Basic Information
                                    </h4>
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                        <div class="md:col-span-2">
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Site Logo</label>
                                            <div class="flex items-center space-x-4">
                                                <div class="flex-shrink-0">
                                                    <img src="<?php echo BASE_URL . ($system_settings['site_logo'] ?? 'assets/images/logo.png'); ?>" 
                                                         alt="Current Logo" class="w-16 h-16 object-contain rounded-lg border border-slate-200">
                                                </div>
                                                <div class="flex-1">
                                                    <input type="file" name="site_logo" accept="image/*" 
                                                           class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                                    <p class="text-xs text-slate-600 mt-1">Upload JPG, PNG, GIF, or SVG. Max 5MB.</p>
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Site Name</label>
                                            <input type="text" name="site_name" value="<?php echo htmlspecialchars($system_settings['site_name'] ?? 'COP Madina Conference Platform'); ?>"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Contact Email</label>
                                            <input type="email" name="contact_email" value="<?php echo htmlspecialchars($system_settings['contact_email'] ?? 'info@copmadinaconf.org'); ?>"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div class="md:col-span-2">
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Site Description</label>
                                            <textarea name="site_description" rows="3"
                                                      class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200 resize-none"><?php echo htmlspecialchars($system_settings['site_description'] ?? 'Conference and Event Management Platform for The Church of Pentecost - Madina Area'); ?></textarea>
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Contact Phone</label>
                                            <input type="tel" name="contact_phone" value="<?php echo htmlspecialchars($system_settings['contact_phone'] ?? '+233 24 123 4567'); ?>"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Timezone</label>
                                            <select name="timezone" class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                                <option value="Africa/Accra" <?php echo ($system_settings['timezone'] ?? 'Africa/Accra') === 'Africa/Accra' ? 'selected' : ''; ?>>Africa/Accra (GMT)</option>
                                                <option value="UTC" <?php echo ($system_settings['timezone'] ?? '') === 'UTC' ? 'selected' : ''; ?>>UTC</option>
                                                <option value="America/New_York" <?php echo ($system_settings['timezone'] ?? '') === 'America/New_York' ? 'selected' : ''; ?>>America/New_York (EST)</option>
                                                <option value="Europe/London" <?php echo ($system_settings['timezone'] ?? '') === 'Europe/London' ? 'selected' : ''; ?>>Europe/London (GMT)</option>
                                            </select>
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Currency</label>
                                            <select name="currency" class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                                <option value="GHS" <?php echo ($system_settings['currency'] ?? 'GHS') === 'GHS' ? 'selected' : ''; ?>>GHS (Ghana Cedi)</option>
                                                <option value="USD" <?php echo ($system_settings['currency'] ?? '') === 'USD' ? 'selected' : ''; ?>>USD (US Dollar)</option>
                                                <option value="EUR" <?php echo ($system_settings['currency'] ?? '') === 'EUR' ? 'selected' : ''; ?>>EUR (Euro)</option>
                                                <option value="GBP" <?php echo ($system_settings['currency'] ?? '') === 'GBP' ? 'selected' : ''; ?>>GBP (British Pound)</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <!-- Header & Footer Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-window-maximize mr-2 text-green-500"></i>
                                        Header & Footer Settings
                                    </h4>
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Header Title</label>
                                            <input type="text" name="site_header_title" value="<?php echo htmlspecialchars($system_settings['site_header_title'] ?? 'COP Madina Conference'); ?>"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Header Subtitle</label>
                                            <input type="text" name="site_header_subtitle" value="<?php echo htmlspecialchars($system_settings['site_header_subtitle'] ?? 'The Church of Pentecost - Madina Area'); ?>"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div class="md:col-span-2">
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Footer Text</label>
                                            <textarea name="footer_text" rows="3"
                                                      class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200 resize-none"><?php echo htmlspecialchars($system_settings['footer_text'] ?? '© 2024 The Church of Pentecost - Madina Area. All rights reserved.'); ?></textarea>
                                        </div>
                                        
                                        <div class="md:col-span-2">
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Footer Links (JSON format)</label>
                                            <textarea name="footer_links" rows="3"
                                                      class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200 resize-none"
                                                      placeholder='[{"name": "Privacy Policy", "url": "/privacy"}, {"name": "Terms of Service", "url": "/terms"}]'><?php echo htmlspecialchars($system_settings['footer_links'] ?? ''); ?></textarea>
                                            <p class="text-xs text-slate-600 mt-1">JSON array of footer links with name and url properties</p>
                                        </div>
                                    </div>
                                </div>

                                <!-- Social Media Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-share-alt mr-2 text-pink-500"></i>
                                        Social Media Links
                                    </h4>
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Facebook URL</label>
                                            <input type="url" name="social_facebook" value="<?php echo htmlspecialchars($system_settings['social_facebook'] ?? ''); ?>"
                                                   placeholder="https://facebook.com/yourpage"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Twitter URL</label>
                                            <input type="url" name="social_twitter" value="<?php echo htmlspecialchars($system_settings['social_twitter'] ?? ''); ?>"
                                                   placeholder="https://twitter.com/yourhandle"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Instagram URL</label>
                                            <input type="url" name="social_instagram" value="<?php echo htmlspecialchars($system_settings['social_instagram'] ?? ''); ?>"
                                                   placeholder="https://instagram.com/yourpage"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">YouTube URL</label>
                                            <input type="url" name="social_youtube" value="<?php echo htmlspecialchars($system_settings['social_youtube'] ?? ''); ?>"
                                                   placeholder="https://youtube.com/yourchannel"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                    </div>
                                </div>

                                <!-- Notification Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-bell mr-2 text-yellow-500"></i>
                                        Notification Settings
                                    </h4>
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                        <div class="flex items-center justify-between p-4 bg-slate-50 rounded-xl">
                                            <div>
                                                <label class="block text-sm font-semibold text-slate-700">Email Notifications</label>
                                                <p class="text-xs text-slate-600">Send email notifications to users</p>
                                            </div>
                                            <label class="relative inline-flex items-center cursor-pointer">
                                                <input type="checkbox" name="email_notifications" class="sr-only peer" <?php echo ($system_settings['email_notifications'] ?? '1') === '1' ? 'checked' : ''; ?>>
                                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
                                            </label>
                                        </div>
                                        
                                        <div class="flex items-center justify-between p-4 bg-slate-50 rounded-xl">
                                            <div>
                                                <label class="block text-sm font-semibold text-slate-700">SMS Notifications</label>
                                                <p class="text-xs text-slate-600">Send SMS notifications to users</p>
                                            </div>
                                            <label class="relative inline-flex items-center cursor-pointer">
                                                <input type="checkbox" name="sms_notifications" class="sr-only peer" <?php echo ($system_settings['sms_notifications'] ?? '0') === '1' ? 'checked' : ''; ?>>
                                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <!-- Registration Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-user-plus mr-2 text-green-500"></i>
                                        Registration Settings
                                    </h4>
                                    <div class="grid grid-cols-1 gap-6">
                                        <div class="flex items-center justify-between p-4 bg-slate-50 rounded-xl">
                                            <div>
                                                <label class="block text-sm font-semibold text-slate-700">Auto-approve Registrations</label>
                                                <p class="text-xs text-slate-600">Automatically approve event registrations</p>
                                            </div>
                                            <label class="relative inline-flex items-center cursor-pointer">
                                                <input type="checkbox" name="auto_approve_registrations" class="sr-only peer" <?php echo ($system_settings['auto_approve_registrations'] ?? '1') === '1' ? 'checked' : ''; ?>>
                                                <div class="w-11 h-6 bg-slate-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <!-- File Upload Settings -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-upload mr-2 text-purple-500"></i>
                                        File Upload Settings
                                    </h4>
                                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Max File Size (MB)</label>
                                            <input type="number" name="max_file_size" value="<?php echo htmlspecialchars($system_settings['max_file_size'] ?? '5'); ?>" min="1" max="100"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Allowed File Types</label>
                                            <input type="text" name="allowed_file_types" value="<?php echo htmlspecialchars($system_settings['allowed_file_types'] ?? 'jpg,jpeg,png,pdf,doc,docx'); ?>"
                                                   placeholder="jpg,jpeg,png,pdf,doc,docx"
                                                   class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200">
                                            <p class="text-xs text-slate-600 mt-1">Comma-separated file extensions</p>
                                        </div>
                                    </div>
                                </div>

                                <!-- Maintenance Mode -->
                                <div>
                                    <h4 class="text-lg font-semibold text-slate-800 mb-4 flex items-center">
                                        <i class="fas fa-tools mr-2 text-red-500"></i>
                                        Maintenance Mode
                                    </h4>
                                    <div class="space-y-4">
                                        <div class="flex items-center justify-between p-4 bg-red-50 rounded-xl border border-red-200">
                                            <div>
                                                <label class="block text-sm font-semibold text-red-700">Enable Maintenance Mode</label>
                                                <p class="text-xs text-red-600">Temporarily disable public access to the site</p>
                                            </div>
                                            <label class="relative inline-flex items-center cursor-pointer">
                                                <input type="checkbox" name="maintenance_mode" class="sr-only peer" <?php echo ($system_settings['maintenance_mode'] ?? '0') === '1' ? 'checked' : ''; ?>>
                                                <div class="w-11 h-6 bg-red-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-red-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-600"></div>
                                            </label>
                                        </div>
                                        
                                        <div>
                                            <label class="block text-sm font-semibold text-slate-700 mb-2">Maintenance Message</label>
                                            <textarea name="maintenance_message" rows="3"
                                                      class="w-full px-4 py-3 border border-slate-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-slate-500 focus:border-transparent transition-all duration-200 resize-none"
                                                      placeholder="The system is currently under maintenance. Please check back later."><?php echo htmlspecialchars($system_settings['maintenance_message'] ?? 'The system is currently under maintenance. Please check back later.'); ?></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="flex justify-end mt-6">
                                <button type="submit" 
                                        class="px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white font-medium rounded-xl transition-all duration-200 shadow-lg">
                                    <i class="fas fa-save mr-2"></i>
                                    Update System Settings
                                </button>
                            </div>
                        </form>
                    </div>
                    <?php endif; ?>

                    <!-- Account Information -->
                    <div class="bg-white/70 backdrop-blur-sm rounded-2xl shadow-lg border border-slate-200/50">
                        <div class="p-6 border-b border-slate-200/50">
                            <h3 class="text-lg font-semibold text-slate-800 flex items-center">
                                <i class="fas fa-info-circle mr-3 text-slate-600"></i>
                                Account Information
                            </h3>
                        </div>
                        <div class="p-6">
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                                <div class="space-y-4">
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-1">Username</label>
                                        <p class="text-slate-800"><?php echo htmlspecialchars($current_user['username']); ?></p>
                                    </div>
                                    
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-1">Role</label>
                                        <span class="px-3 py-1 text-sm font-semibold rounded-full <?php 
                                            echo $current_user['role'] === 'superuser' ? 'bg-red-100 text-red-800' : 
                                                ($current_user['role'] === 'area_admin' ? 'bg-blue-100 text-blue-800' : 
                                                ($current_user['role'] === 'district_admin' ? 'bg-emerald-100 text-emerald-800' : 
                                                ($current_user['role'] === 'assembly_admin' ? 'bg-purple-100 text-purple-800' : 'bg-slate-100 text-slate-800'))); 
                                        ?>">
                                            <?php echo ucfirst(str_replace('_', ' ', $current_user['role'])); ?>
                                        </span>
                                    </div>
                                </div>
                                
                                <div class="space-y-4">
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-1">Account Created</label>
                                        <p class="text-slate-800"><?php echo date('M j, Y g:i A', strtotime($current_user['created_at'])); ?></p>
                                    </div>
                                    
                                    <div>
                                        <label class="block text-sm font-semibold text-slate-700 mb-1">Status</label>
                                        <span class="px-3 py-1 text-sm font-semibold rounded-full <?php echo $current_user['status'] === 'active' ? 'bg-emerald-100 text-emerald-800' : 'bg-red-100 text-red-800'; ?>">
                                            <?php echo ucfirst($current_user['status']); ?>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Quick Actions -->
                    <div class="bg-white/70 backdrop-blur-sm rounded-2xl shadow-lg border border-slate-200/50">
                        <div class="p-6 border-b border-slate-200/50">
                            <h3 class="text-lg font-semibold text-slate-800 flex items-center">
                                <i class="fas fa-bolt mr-3 text-slate-600"></i>
                                Quick Actions
                            </h3>
                        </div>
                        <div class="p-6">
                            <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                                <a href="<?php echo BASE_URL; ?>admin/index.php" 
                                   class="flex items-center p-4 bg-slate-50 hover:bg-slate-100 rounded-xl transition-colors">
                                    <i class="fas fa-tachometer-alt text-slate-600 mr-3"></i>
                                    <span class="font-medium text-slate-800">Dashboard</span>
                                </a>
                                
                                <a href="<?php echo BASE_URL; ?>admin/events.php" 
                                   class="flex items-center p-4 bg-slate-50 hover:bg-slate-100 rounded-xl transition-colors">
                                    <i class="fas fa-calendar-alt text-slate-600 mr-3"></i>
                                    <span class="font-medium text-slate-800">Manage Events</span>
                                </a>
                                
                                <a href="<?php echo BASE_URL; ?>admin/reports.php" 
                                   class="flex items-center p-4 bg-slate-50 hover:bg-slate-100 rounded-xl transition-colors">
                                    <i class="fas fa-chart-bar text-slate-600 mr-3"></i>
                                    <span class="font-medium text-slate-800">View Reports</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <script>
        const { createApp } = Vue;
        
        createApp({
            data() {
                return {
                    // Add any reactive data here if needed
                }
            },
            methods: {
                // Add any methods here if needed
            }
        }).mount('#app');
    </script>
</body>
</html>

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