Errors:
imagepng(): supplied argument is not a valid Image resource in /home/publicr/public_html/dynsigs/anything.php on line 29
Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/publicr/public_html/dynsigs/anything.php on line 29
PHP:
<php><?PHP
function sql_sanitize( $sCode ) {
if ( function_exists( "mysql_real_escape_string" ) ) { // If PHP version > 4.3.0
$sCode = mysql_real_escape_string( $sCode ); // Escape the MySQL string.
} else { // If PHP version < 4.3.0
$sCode = addslashes( $sCode ); // Precede sensitive characters with a slash \
}
return $sCode; // Return the sanitized code
$dbhost = 'xxx'; $dbuser = 'xxx'; $dbpass = 'xxxx'; $dbname = 'xxxx'; if (isset($_GET['user'])) { $username = sql_sanitize($_GET['user']); } else { die("no charname given"); } $serverdesc = 'Majuzza Gaming: Roleplay Character Statistics'; $pathtoimg = 'stats_img.png';
//Connect to the database $conn = mysql_connect("$dbhost","$dbuser","$dbpass"); $db = mysql_select_db("$dbname"); $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname);
//Pull the info from the row with $username as their name $query = "SELECT * FROM users WHERE username = '$username'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) {
extract($row);
}
// Let's do a function, shall we? =D // Let's see if they are online and assign a variable if ($online == '0') { $reallyonline = 'Offline'; } else { $reallyonline = 'Online'; }
//Set up the image and font style(s) and color(s) Header ("Content-type: image/png"); $img_handle = imageCreateFromPNG("$pathtoimg"); $color = ImageColorAllocate ($img_handle, 0, 0, 0);
// Show your server's info, w00t! =D ImageString ($img_handle, 2, 25, 7, "$serverdesc", $color); //Show Players IGN and level ImageString ($img_handle, 3, 70, 23, "$name ($reallyonline)", $color); ImageString ($img_handle, 3, 70, 35, "Hours Played:", $color); ImageString ($img_handle, 2, 115, 35, "$hoursplayed", $color); // Show HP ImageString ($img_handle, 3, 70, 47, "Admin Level:", $color); ImageString ($img_handle, 2, 93, 47, "$adminlevel", $color); // Show Gold ImageString ($img_handle, 3, 70, 71, "Cash:", $color); ImageString ($img_handle, 2, 108, 71, "$money", $color);
ImagePng ($img_handle); ImageDestroy ($img_handle); //Close the Database connection just in case it didn't do it already mysql_close($conn);
?></php>
What is wrong?? :(.
The .png is in the same folder, and so is .htaccess, which is:
RewriteRule ^/([a-z]+)\.png$ /anything.php?user=$1
^ Webhost told me i dont need <PHP> tags in .htacess