Autosave: 20260306-030930

This commit is contained in:
Flatlogic Bot 2026-03-06 03:09:30 +00:00
parent 645e874eb2
commit 10f9e8ec3f
2 changed files with 74 additions and 1 deletions

View File

@ -9,6 +9,7 @@ if (isset($_SESSION['user_id'])) {
$stmt = $db->prepare("SELECT role FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$u_data = $stmt->fetch();
$stmt = $db->prepare("SELECT u.level, u.grade, g.name as grade_name, g.image_url as grade_image FROM users u LEFT JOIN grades g ON u.grade = g.slug WHERE u.id = ?"); $stmt->execute([$_SESSION["user_id"]]); $extra = $stmt->fetch(); $_SESSION["level"] = $extra["level"]; $_SESSION["grade_name"] = $extra["grade_name"]; $_SESSION["grade_image"] = $extra["grade_image"];
$user_role = $u_data['role'] ?? 'user';
}
@ -555,6 +556,9 @@ function getStatusColor($status, $statuses_map) {
<body>
<div id="main-wrapper">
<header id="top-bar">
<?php if (isset($_SESSION["user_id"])): ?>
<button type="button" onclick="document.getElementById('profileModal').style.display='flex'" style="background:none; border:none; color:#88c0d0; cursor:pointer; font-size:11px; font-weight:bold; margin-right:auto;">Voir mon profil public</button>
<?php endif; ?>
<div class="user-auth-bar">
<?php if (isset($_SESSION['user_id'])): ?>
<span>Bienvenue, <span class="username">@<?php echo htmlspecialchars($_SESSION["display_name"] ?? $_SESSION["username"]); ?></span></span>
@ -930,5 +934,25 @@ function getStatusColor($status, $statuses_map) {
document.getElementById('planetModal').style.display = 'none';
}
</script>
<!-- PROFILE MODAL -->
<div id="profileModal" class="modal-overlay" onclick="if(event.target === this) this.style.display='none'">
<div class="modal-container">
<div class="modal-header">
<h2>Profil Public</h2>
<button class="modal-close" onclick="document.getElementById('profileModal').style.display='none'">&times;</button>
</div>
<div class="modal-body" style="text-align: center;">
<div style="font-size: 24px; margin-bottom: 20px; color: #fff;">
<?php echo htmlspecialchars($_SESSION["grade_name"] ?? "N/A"); ?> <?php echo htmlspecialchars($_SESSION["display_name"] ?? $_SESSION["username"]); ?>
</div>
<div style="margin-bottom: 20px;">
<img src="<?php echo htmlspecialchars($_SESSION["grade_image"] ?? "assets/images/placeholder_grade.png"); ?>" style="width:100px; height:100px;">
</div>
<div class="stat-card" style="text-align: center; font-size: 18px; color: #88c0d0;">
Niveau <?php echo htmlspecialchars($_SESSION["level"] ?? "N/A"); ?>
</div>
</div>
</div>
</div>
</body>
</html>
</html>

49
profile.php Normal file
View File

@ -0,0 +1,49 @@
<?php
require_once 'db/config.php';
$username = $_GET['player'] ?? '';
$db = db();
$user = null;
if (!empty($username)) {
$stmt = $db->prepare("SELECT username, display_name, level, grade FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profil Joueur - Nexus</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
body { background: #000; margin: 0; padding: 20px; font-family: Arial, sans-serif; color: #fff; background-image: radial-gradient(circle at 50% 50%, #1a2a4a 0%, #000 70%); min-height: 100vh; }
.profile-container { background: rgba(10, 15, 30, 0.95); border: 1px solid #4c566a; padding: 30px; width: 100%; max-width: 500px; margin: 0 auto; box-shadow: 0 0 20px rgba(0,0,0,0.8); text-align: center; }
h2 { text-transform: uppercase; color: #88c0d0; margin-bottom: 20px; }
.stat-card { padding: 15px; background: rgba(0,0,0,0.3); border: 1px solid #2d3545; margin-bottom: 15px; text-align: left; }
.stat-card strong { color: #8c92a3; display: block; font-size: 12px; text-transform: uppercase; margin-bottom: 5px; }
.not-found { color: #bf616a; }
.nav-links { margin-top: 25px; font-size: 13px; }
.nav-links a { color: #88c0d0; text-decoration: none; }
</style>
</head>
<body>
<div class="profile-container">
<?php if ($user): ?>
<h2><i class="fa-solid fa-user"></i> Profil de <?php echo htmlspecialchars($user['display_name']); ?></h2>
<div class="stat-card"><strong>Identifiant</strong> @<?php echo htmlspecialchars($user['username']); ?></div>
<div class="stat-card"><strong>Niveau</strong> <?php echo htmlspecialchars($user['level'] ?? 'N/A'); ?></div>
<div class="stat-card"><strong>Grade</strong> <?php echo htmlspecialchars($user['grade'] ?? 'N/A'); ?></div>
<?php else: ?>
<h2 class="not-found">Joueur introuvable</h2>
<p>Le profil demandé n'existe pas ou a été supprimé.</p>
<?php endif; ?>
<div class="nav-links">
<a href="index.php"><i class="fa-solid fa-arrow-left"></i> Retour au Nexus</a>
</div>
</div>
</body>
</html>