Sindbad~EG File Manager
<?php
require_once '../config/config.php';
require_once '../classes/MemberAuth.php';
// Check if member is logged in
if (!MemberAuth::isMemberLoggedIn()) {
redirect('../login.php');
}
$pageTitle = "Account Settings - " . APP_NAME;
$db = Database::getInstance()->getConnection();
$success = '';
$error = '';
// Get current member data
$currentMember = MemberAuth::getCurrentMember();
if (!$currentMember) {
redirect('../login.php');
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_account'])) {
try {
$memberAuth = new MemberAuth();
$updateData = [];
if (!empty($_POST['email']) && $_POST['email'] !== $currentMember['email']) {
$updateData['email'] = $_POST['email'];
}
if (!empty($_POST['new_password'])) {
if ($_POST['new_password'] !== $_POST['confirm_password']) {
throw new Exception("Passwords do not match");
}
if (strlen($_POST['new_password']) < 6) {
throw new Exception("Password must be at least 6 characters long");
}
$updateData['password'] = $_POST['new_password'];
}
if (!empty($updateData)) {
$result = $memberAuth->updateMemberAccount($currentMember['id'], $updateData);
if ($result['success']) {
$success = "Account details updated successfully!";
$currentMember = MemberAuth::getCurrentMember();
} else {
$error = $result['message'];
}
} else {
$error = "No changes to update";
}
} catch (Exception $e) {
$error = "Error updating account: " . $e->getMessage();
}
}
// 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); }
.border-primary { border-color: var(--primary-color); }
.gradient-bg { background: linear-gradient(135deg, #1E40AF 0%, #9333EA 50%, #F97316 100%); }
</style>
</head>
<body class="bg-gray-50">
<!-- Member Portal Header -->
<header class="bg-white shadow-lg sticky top-0 z-50">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between h-16">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-xl flex items-center justify-center gradient-bg">
<i class="fas fa-church text-white"></i>
</div>
<div>
<h1 class="text-lg font-bold text-gray-800"><?php echo htmlspecialchars($settings['site_title']); ?></h1>
<p class="text-xs text-gray-500">Member Portal</p>
</div>
</div>
<nav class="hidden md:flex items-center space-x-6">
<a href="dashboard.php" class="text-gray-700 hover:text-blue-600 transition">
<i class="fas fa-home mr-1"></i>Dashboard
</a>
<a href="profile.php" class="text-gray-700 hover:text-blue-600 transition">
<i class="fas fa-user mr-1"></i>Profile
</a>
<a href="messages.php" class="text-gray-700 hover:text-blue-600 transition">
<i class="fas fa-comments mr-1"></i>Messages
</a>
<a href="event-checkin.php" class="text-gray-700 hover:text-green-600 transition">
<i class="fas fa-qrcode mr-1"></i>Event Check-in
</a>
<a href="transfer_request.php" class="text-gray-700 hover:text-blue-600 transition">
<i class="fas fa-exchange-alt mr-1"></i>Transfer
</a>
</nav>
<div class="flex items-center space-x-3">
<span class="text-sm text-gray-600 hidden md:block">Welcome, <?php echo htmlspecialchars($currentMember['full_name'] ?? 'Member'); ?></span>
<a href="../logout.php?member=1" class="text-gray-600 hover:text-red-600 transition">
<i class="fas fa-sign-out-alt mr-1"></i>Logout
</a>
</div>
</div>
</div>
</header>
<div class="container mx-auto px-4 py-8">
<div class="max-w-2xl mx-auto">
<!-- Page Header -->
<div class="mb-8">
<a href="dashboard.php" class="text-sm text-blue-600 hover:text-blue-800 mb-2 inline-block">
<i class="fas fa-arrow-left mr-1"></i>Back to Dashboard
</a>
<h1 class="text-3xl font-bold text-gray-800">
<i class="fas fa-cog mr-2 text-orange-500"></i>Account Settings
</h1>
<p class="text-gray-600 mt-2">Manage your login credentials, email, and password security settings</p>
</div>
<!-- Messages -->
<?php if ($success): ?>
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6">
<i class="fas fa-check-circle mr-2"></i><?php echo $success; ?>
</div>
<?php endif; ?>
<?php if ($error): ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg mb-6">
<i class="fas fa-exclamation-circle mr-2"></i><?php echo $error; ?>
</div>
<?php endif; ?>
<!-- Security Settings Card -->
<div class="bg-gradient-to-r from-blue-50 to-purple-50 border-2 border-blue-200 rounded-xl shadow-lg p-6 mb-6">
<div class="flex items-center justify-between">
<div class="flex items-center">
<div class="w-14 h-14 rounded-full bg-gradient-to-r from-blue-600 to-purple-600 flex items-center justify-center mr-4">
<i class="fas fa-shield-alt text-white text-2xl"></i>
</div>
<div>
<h3 class="text-lg font-bold text-gray-800">Two-Factor Authentication</h3>
<p class="text-sm text-gray-600">Add an extra layer of security to your account</p>
</div>
</div>
<a href="security.php" class="px-6 py-3 bg-gradient-to-r from-blue-600 to-purple-600 text-white rounded-lg hover:shadow-lg transition-all">
<i class="fas fa-cog mr-2"></i>Manage 2FA
</a>
</div>
</div>
<!-- Account Settings Form -->
<div class="bg-white rounded-xl shadow-lg p-8">
<form method="POST" class="space-y-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Username</label>
<input type="text" value="<?php echo htmlspecialchars($currentMember['username']); ?>"
class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-gray-100" readonly>
<p class="text-xs text-gray-500 mt-1">Username cannot be changed</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Email Address</label>
<input type="email" name="email" value="<?php echo htmlspecialchars($currentMember['email']); ?>"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary">
<p class="text-xs text-gray-500 mt-1">Update your email address for notifications</p>
</div>
<hr class="my-6">
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4">
<h3 class="font-semibold text-blue-800 mb-2">
<i class="fas fa-lock mr-2"></i>Change Password
</h3>
<p class="text-sm text-blue-700">Leave these fields blank if you don't want to change your password</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">New Password</label>
<input type="password" name="new_password"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary">
<p class="text-xs text-gray-500 mt-1">Must be at least 6 characters long</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Confirm New Password</label>
<input type="password" name="confirm_password"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary">
<p class="text-xs text-gray-500 mt-1">Re-enter your new password</p>
</div>
<div class="flex gap-3 justify-end pt-4">
<a href="dashboard.php" class="px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition">
Cancel
</a>
<button type="submit" name="update_account" class="bg-primary text-white px-6 py-2 rounded-lg hover:opacity-90 transition">
<i class="fas fa-save mr-2"></i>Update Account
</button>
</div>
</form>
</div>
</div>
</div>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-6 mt-12">
<div class="container mx-auto px-4 text-center">
<p class="text-sm text-gray-400">
© <?php echo date('Y'); ?> <?php echo htmlspecialchars($settings['site_title']); ?>. All rights reserved.
</p>
</div>
</footer>
<?php
// Include Chat Hub Widget (Admin Chat + AI Chatbot)
if (file_exists(__DIR__ . '/../includes/chat-hub-widget.php')) {
include '../includes/chat-hub-widget.php';
}
?>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists