<?php
#ImgStats (c) generation-forum.com
#Benötigte Daten aus der SQL-Datanbank auslesen
$usrid = $userdata['userid'];
$file = 'usrimgs/'.$usrid.'.png';
$time = filemtime($file);
$time = $time + 1; // Die 86400 (24 std) gibt an wan die grafik neu generiet wird in sekunden gerechnet
$now = time();
If ($now >= $time){
unlink($file);
}
$result=$db->query("SELECT * FROM cc1_users WHERE userid ='$usrid'");
while($row=$db->fetch_array($result)) {
$username_1=$row['username'];
$punkte_1=$row['points'];
$alli_1=$row['allianzid'];
}
$result=$db->query("SELECT * FROM cc1_allianz WHERE aid ='$alli_1'");
while($row=$db->fetch_array($result)) {
$alianz_2=$row['name'];
}
$result_l=$db->query("SELECT islandid FROM cc1_countries WHERE userid='$usrid'");
$numoflands_1=$db->num_rows($result_l);
//header('Content-type: image/png');
$imgfile='usrimgs/'.$usrid.'.png';
$nwm=imagefontwidth(1)*strlen($username_1);
$w=$nwm+88; // Breite in Pixel
$h=60; // Höhe in Pexel
$hImg=imagecreate($w,$h);
$grey=imagecolorallocate($hImg, 245, 255, 220); // Hintergrund farbe RGB gerechnet 0, 0, 0 = weiss
$black=imagecolorallocate($hImg, 0, 0, 0); // Schriftfarbe und Randfarbe für die grafik
imagerectangle($hImg, 0, 0, $w-1, $h-1, $black);
$darkred=imagecolorallocate($hImg, 255, 0, 0); // Farbe für den game Name
imagestringup($hImg, 3, 1, $h-8, 'BGF', $darkred); // BGF durch den spiel name ergänzen ( ambesten die eine apkürzung )
imagestring($hImg, 2, 20, 3,'Name: '.$username_1, $black);
imagestring($hImg, 2, 20, 15, 'Punkte: '.$punkte_1, $black);
imagestring($hImg, 2, 20, 28, 'Allianz: '.$alianz_2, $black);
imagestring($hImg, 2, 20, 41, 'Länder: '.$numoflands_1, $black);
imagepng($hImg, $imgfile);
chmod($imgfile, 0777);
imagepng($hImg);
imagedestroy($hImg);
?>