//signature
/*
http://yoururl.com/game.php?act=sig&user=username
*/
function sig() {
header("Content-type: image/gif"); //this lines tells the browers that the PHP file is a PNG image
$user = $_GET["user"]; //username to display on the signature
$img = imagecreatefrompng("image.gif");
$black = imagecolorallocate($img,0,0,0); //makes the background color black
$lime = imagecolorallocate($img,50,205,50); //the color white (used for text)
//if you want to change the text or backgroud color then re-enter the RGB values
imagestring($img,1,1,0,"Chao Online",$lime); //draws the text "Name of your game" (the first number is the size of the text, the second is the x position of the text, the third is the y position of the text)
$statsq = mysql_query("SELECT * FROM users WHERE username='$user'") or die("ERROR"); //mysql query to get * (meaning anyting) from the table where the username is $user
while ($stats = mysql_fetch_assoc($statsq)) {
imagestring($img,1,1,10,"Username: $stats[username]",$lime); //draws the players username
imagestring($img,1,1,20,"Score: $stats[score]",$lime); //draws the players score
if ($stats[online]) {
imagestring($img,1,1,30,"Status: Online",$lime);
} else {
imagestring($img,1,1,30,"Status: Offline",$lime);
}
}
imagegif($img); //draws the whole image as a PNG
imagedestroy($img); //destroys the whole image
}