Hi,
I have a small code to display some data from mysql db as .png image, however the image loads but it doesn't show any data on it.
php:
<?
$username="";
$password="";
$database="";
$host="";
$player_name=$_GET['player_name'];
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database. Be sure the databasename exists and online is.");
$player_name = stripslashes($player_name);
$player_name = mysql_real_escape_string($player_name);
$query="SELECT * FROM characters WHERE name='$player_name'";
$result=mysql_query($query);
$i=mysql_num_rows($result);
if ($i == 1)
{
$name=mysql_result($result,0,"name");
$OnServer=mysql_result($result,0,"OnServer");
$hours=mysql_result($result,0,"hours");
header('Content-Type: image/png;');
$im = @imagecreatefrompng('1.png') or die("Cannot select the correct image. Please contact the webmaster.");
$text_color = imagecolorallocate($im, 197,197,199);
$text_username = "$name";
$text_hours = "$hours";
$text_online = "$OnServer";
$font = 'visitor2.ttf';
imagettftext($im, 2, 0, 39, 15, $text_color, $font, $text_username);
imagettftext($im, 2, 0, 160, 15, $text_color, $font, $text_hours);
imagettftext($im, 2, 0, 297, 15, $text_color, $font, $text_online);
imagepng($im);
imagedestroy($im);
} else echo('Username is not in our database. Please try again.');
mysql_close();
?>
html:
<html>
<head>
<title>My title here</title>
</head>
<h1>Signature configuration.</h1>
<p>Hello and welcome to the image configuration page.<br />
Before you can make your signature, we need in-game name, exact as it is.</p>
<form action="signature.php" method="get">
Playername:
<input type="Submit">
</form>
</body>
</html>
sql dump: http://pastebin.com/zXHgCDpt
Any ideas? (it's 6am in here so I probably missed something obvious, sorry about that)