<?php
header("Content-type: image/png");
// ----------------------------
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pass = "";
$mysql_db = "forum";
$mysql_table = "mybb_stats";
// ----------------------------
$con = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
$q = mysql_query("SELECT * FROM mybb_stats ORDER BY dateline DESC LIMIT 1");
$row = mysql_fetch_array($q);
$stats['posts'] = $row['numposts'];
$stats['threads'] = $row['numthreads'];
$stats['users'] = $row['numusers'];
$img = imagecreatetruecolor(150, 52);
$color['gray'] = imagecolorallocate($img, 51, 51, 51);
$color['white'] = imagecolorallocate($img, 255, 255, 255);
imagefill($img, 0, 0, $color['gray']);
imagettftext($img, 11, 0, 5, 15, $color['white'], "font.ttf", "Members: ".$stats['users']);
imagettftext($img, 11, 0, 5, 30, $color['white'], "font.ttf", "Threads: ".$stats['threads']);
imagettftext($img, 11, 0, 5, 45, $color['white'], "font.ttf", "Posts: ".$stats['posts']);
imagepng($img);
imagedestroy($img);
mysql_close($con);
?>