1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | | PHP-Quelltext
<?php
$sqlhost = "**.25.***.98"; // host
$sqluser = "****"; // user
$sqlpass = "n#****B"; // pass
$characterdb = "Char"; // character database
$maxplayers = "1000"; // max player count
// DO NOT EDIT BELOW THIS
// REALLY
// DONT FUCK IT UP
// IS IT REALLY WORTH IT?
// THINK ABOUT IT..
// lol
// dont do it!!!
//
//
//
// well, now whos the idiot?
// you just got told by PHP
// bitch
$link = mysql_connect($sqlhost,$sqluser,$sqlpass);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($characterdb);
$query = mysql_query("SELECT COUNT(*) from characters WHERE online = '1'");
/* ok got info */
$info = mysql_result($query, 0);
/* ok done! */
// the image it uses $info for sql rows
$width = 100;
$height = 20;
$almost = $info/$width;
$pinfo = $almost*100;
$image = ImageCreate($width, $height);
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$orange = ImageColorAllocate($image, 210, 105, 30);
ImageFill($image, 0, 0, $black);
imagefilledrectangle($image, 0, 0, $pinfo, 20, $orange);
ImageString($image, 3, 40, 3, "$info / $maxplayers", $white);
header("Content-Type: image/jpeg");
ImageJpeg($image);
ImageDestroy($image);
mysql_close($link);
?>
[ |