updateUsername($newUsername); $_SESSION['success'] = $message; break; case 'updateEmail': $newEmail = trim($_POST['new_email'] ?? ''); $message = $user->updateEmail($newEmail, $config); $_SESSION['success'] = $message; break; case 'updateName': $firstName = trim($_POST['first_name'] ?? ''); $lastName = trim($_POST['last_name'] ?? ''); $message = $user->updateName($firstName, $lastName); $_SESSION['success'] = $message; break; case 'updatePassword': $currentPassword = $_POST['current_password'] ?? ''; $newPassword = $_POST['new_password'] ?? ''; $confirmPassword = $_POST['confirm_password'] ?? ''; $message = $user->updatePassword($currentPassword, $newPassword, $confirmPassword); $_SESSION['success'] = $message; break; // Optionally, handle other actions such as profile picture update. default: throw new Exception("Invalid action."); } } catch (Exception $e) { $_SESSION['error'] = $e->getMessage(); } header("Location: profile.php"); exit; } // Retrieve user data using getter methods. $userData = [ 'id' => $user->getId(), 'username' => $user->getUsername(), 'firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'email' => $user->getEmail(), 'img' => $user->getImg(), 'emailVerified' => $user->getVerified(), ]; // Determine if editing should be disabled (e.g., if email not verified) $editingDisabled = ((int)$userData['emailVerified'] !== 1); $alertMessage = $editingDisabled ? "Please verify your email to enable profile editing." : ""; require_once 'includes/header.php'; ?>
avatar
:
:
:
Password
Additional Features

Followed DJs and recent ratings will appear here once implemented.

Admin Session Output