game/htdocs/sign.php

65 lines
3.3 KiB
PHP
Raw Normal View History

2008-11-16 11:00:00 +00:00
<?php
define("INDEX", 1);
$chrono_start = microtime();
$onyx = @file_get_contents('./.onyx') or die("Configuration introuvable.");
define("_FCORE",trim($onyx));
require_once(_FCORE."common.php");
// Là, on défini le header de la page pour la transformer en image
header ("Content-type: image/png");
// Là, on crée notre image
$_img = imagecreatefrompng(_FCORE."hb_game/signatures/userbarallicopygs1.png");
// On défini maintenant les couleurs
// Couleur de fond :
//$arriere_plan = imagecolorallocate($_img, 0, 0, 0); // Au cas où on utiliserai pas d'image de fond, on utilise cette couleur là.
// Autres couleurs :
$blanc = imagecolorallocate($_img, 255, 255, 255); // Couleur du texte
$rouge = imagecolorallocate($_img, 255, 0, 0); // Couleur du texte
$fontfile = _FCORE."hb_game/signatures/ARIAL.TTF";
if (!isset($_GET['i']) || !is_numeric($_GET['i'])) $_GET['i'] = 0;
$id = $_GET['i'];
$bdd->connexion();
$bdd->escape($id);
$joueur = $bdd->unique_query("SELECT $table_user.pseudo, $table_user.race, $table_user.place_points, $table_user.points, $table_user.batiments, $table_user.flotte, $table_alliances.tag, $table_alliances.nom FROM $table_user INNER JOIN $table_alliances ON $table_user.id_alliance = $table_alliances.id WHERE $table_user.id = $id;");
if ($joueur == false) $joueur = $bdd->unique_query("SELECT pseudo, race, place_points, points, batiments, flotte FROM $table_user WHERE id = $id;");
$nomjoueur = $joueur['pseudo'];
$raid = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM $table_mail WHERE destinataire = '$nomjoueur' AND contenu LIKE '<b>Le combat contre % est termi%';");
$transport = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM $table_mail WHERE contenu LIKE 'Les vaisseaux de $nomjoueur %';");
$bdd->deconnexion();
if ($joueur['race'] == 'covenant') $_imgavatar = imagecreatefrompng(_FCORE."hb_game/signatures/covi.png");
else $_imgavatar = imagecreatefrompng(_FCORE."hb_game/signatures/hum.png");
if ($joueur == false) ImageTTFText($_img, 20, -20, 123, 17, $rouge, $fontfile, 'Joueur introuvable !');
else {
ImageTTFText($_img, 12, 0, 45, 23, $blanc, $fontfile, ucfirst($joueur['pseudo']));
if (isset($joueur['tag'])) {
ImageTTFText($_img, 12, 0, 32, 45, $blanc, $fontfile, "Classement : ".separerNombres($joueur['place_points']).($joueur['place_points']==1?'er':'ème'));
ImageTTFText($_img, 12, 0, 32, 62, $blanc, $fontfile, "Points : ".separerNombres($joueur['points']));
ImageTTFText($_img, 12, 0, 32, 80, $blanc, $fontfile, "Alliance : [".$joueur['tag']."] ".substr($joueur['nom'],0,9).(strlen($joueur['nom'])>9?'...':''));
}
else {
ImageTTFText($_img, 12, 0, 32, 52, $blanc, $fontfile, "Classement : ".separerNombres($joueur['place_points']).($joueur['place_points']==1?'er':'ème'));
ImageTTFText($_img, 12, 0, 32, 72, $blanc, $fontfile, "Points : ".separerNombres($joueur['points']));
}
ImageTTFText($_img, 12, 0, 275, 52, $blanc, $fontfile, $raid['nombre']);
ImageTTFText($_img, 12, 0, 275, 78, $blanc, $fontfile, $joueur['batiments']);
ImageTTFText($_img, 12, 0, 355, 52, $blanc, $fontfile, $joueur['flotte']);
ImageTTFText($_img, 12, 0, 355, 78, $blanc, $fontfile, $transport['nombre']);
}
imagecopy($_img, $_imgavatar, 435, 0, 0, 0, 98, 100);
imagealphablending($_img, false);
imagesavealpha($_img, true);
imagealphablending($_imgavatar, false);
imagesavealpha($_imgavatar, true);
imagepng($_img);
?>