Ajout d'un easteregg
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// Sert la photo de profil d'un joueur "Presse-Citron", stockée en base
|
||||
// (voir migration Juillet 2026 (8)). Public : pas besoin d'être connecté pour voir
|
||||
// les avatars affichés dans le classement.
|
||||
|
||||
require_once('../functions/databaseConnection.php');
|
||||
|
||||
$playerId = $_GET['player_id'] ?? '';
|
||||
|
||||
if (!is_numeric($playerId)) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = $dbh->prepare('SELECT avatar_data, avatar_mime FROM lemon_avatars WHERE player_id = :id');
|
||||
$stmt->bindValue(':id', (int) $playerId, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$row) {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: ' . $row['avatar_mime']);
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('Content-Length: ' . strlen($row['avatar_data']));
|
||||
header('Content-Disposition: inline');
|
||||
// Les avatars changent rarement : cache navigateur d'une heure, comme les PDF (voir viewPdf.php)
|
||||
header('Cache-Control: public, max-age=3600');
|
||||
echo $row['avatar_data'];
|
||||
exit;
|
||||
Reference in New Issue
Block a user