From c7144cbd7ee184d07bd30373ad96dfa8b2b2d9c8 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 6 Mar 2026 10:39:15 +0000 Subject: [PATCH] Alpha V2.5.6 --- account.php | 89 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 10 deletions(-) diff --git a/account.php b/account.php index df0871b..1f80be9 100644 --- a/account.php +++ b/account.php @@ -17,6 +17,16 @@ $stmt = $db->prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); +// Fetch available titles +$stmt = $db->prepare("SELECT * FROM titles WHERE (allowed_user_type = 'all' OR allowed_user_type = ?) AND required_level <= ? ORDER BY name ASC"); +$stmt->execute([$user['user_type'] ?? 'user', $user['level_id'] ?? 1]); +$available_titles = $stmt->fetchAll(); + +// Fetch available badges +$stmt = $db->prepare("SELECT * FROM badges WHERE (allowed_user_type = 'all' OR allowed_user_type = ?) AND required_level <= ? ORDER BY name ASC"); +$stmt->execute([$user['user_type'] ?? 'user', $user['level_id'] ?? 1]); +$available_badges = $stmt->fetchAll(); + if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; @@ -57,10 +67,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } } elseif ($action === 'update_display_name') { $display_name = trim($_POST['display_name'] ?? ''); + $selected_title_id = $_POST['selected_title_id'] ?? null; + $selected_badge_id = $_POST['selected_badge_id'] ?? null; + + if ($selected_title_id === '') $selected_title_id = null; + if ($selected_badge_id === '') $selected_badge_id = null; + if (!empty($display_name)) { - $stmt = $db->prepare("UPDATE users SET display_name = ? WHERE id = ?"); - $stmt->execute([$display_name, $user_id]); - $_SESSION["display_name"] = $display_name; $success = "Nom affiché mis à jour avec succès."; + $stmt = $db->prepare("UPDATE users SET display_name = ?, selected_title_id = ?, selected_badge_id = ? WHERE id = ?"); + $stmt->execute([$display_name, $selected_title_id, $selected_badge_id, $user_id]); + $_SESSION["display_name"] = $display_name; + $success = "Informations de jeu mises à jour avec succès."; $stmt = $db->prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); @@ -89,7 +106,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { .tab-content.active { display: block; } .form-group { margin-bottom: 20px; } label { display: block; margin-bottom: 5px; color: #8c92a3; font-size: 14px; } - input { width: 100%; padding: 10px; background: #000; border: 1px solid #4c566a; color: #fff; box-sizing: border-box; } + input, select { width: 100%; padding: 10px; background: #000; border: 1px solid #4c566a; color: #fff; box-sizing: border-box; } .inline-form { display: flex; gap: 10px; align-items: end; } .inline-form input { flex-grow: 1; } .inline-form button { width: auto; padding: 10px 20px; } @@ -101,6 +118,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { .alert-success { background: rgba(163, 190, 140, 0.2); border: 1px solid #a3be8c; color: #a3be8c; } .nav-links { display: flex; justify-content: space-between; margin-top: 25px; border-top: 1px solid #2d3545; padding-top: 15px; font-size: 13px; } .nav-links a { color: #88c0d0; text-decoration: none; } + .badge-preview { margin-top: 10px; text-align: center; background: rgba(0,0,0,0.5); padding: 10px; border: 1px dashed #4c566a; display: none; } + .badge-preview img { max-width: 64px; max-height: 64px; } @@ -117,13 +136,43 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

Vue d\'ensemble

Pseudo de compte: @
-
+ - -
- - + +
+ +
+ +
+ + +
+ +
+ + +
+ + Badge Preview +
+
+ +
@@ -163,6 +212,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { document.getElementById(id).classList.add('active'); event.currentTarget.classList.add('active'); } + + function updateBadgePreview() { + const selector = document.getElementById('badge-selector'); + const selectedOption = selector.options[selector.selectedIndex]; + const imgUrl = selectedOption.getAttribute('data-img'); + const previewContainer = document.getElementById('badge-preview-container'); + const previewImg = document.getElementById('badge-preview-img'); + + if (imgUrl) { + previewImg.src = imgUrl; + previewContainer.style.display = 'block'; + } else { + previewContainer.style.display = 'none'; + } + } + + // Initialize preview on load + window.onload = function() { + updateBadgePreview(); + }; - \ No newline at end of file +