zackcez Posted May 26, 2008 Share Posted May 26, 2008 Ok, I have this code: <?php $bd_host = ""; // Database host $bd_usuario = ""; // Database username $bd_password = ""; // Database password $bd_base = ""; // Database name $con = mysql_connect($bd_host, $bd_usuario, $bd_password); mysql_select_db($bd_base, $con); $user = $_GET['name']; $sql = "SELECT * FROM user WHERE pet_name='$user'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $level = $row["level"]; $new_level = $level + 1; $pet_name = $row["pet_name"]; //UPDATE VIEW/LEVEL mysql_query("UPDATE user SET level = '$new_level' WHERE pet_name = '$pet_name'"); //END OF UPDATE $color = $row["color"]; $browser = $_SERVER['HTTP_USER_AGENT']; $realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if ($level == null) { $back = 'http://deluzion-gaming.net/pixelplushies/pets/error.jpg'; } else if ($level <= 26) { $back = 'http://deluzion-gaming.net/pixelplushies/pets/1to25_$color.jpg'; } else if ($level <= 76) { $back = 'http://deluzion-gaming.net/pixelplushies/pets/26to75_$color.jpg'; } else if ($level <= 125) { $back = 'http://deluzion-gaming.net/pixelplushies/pets/76to125_$color.jpg'; } else if ($level >= 125) { $back = 'http://deluzion-gaming.net/pixelplushies/pets/126up_$color.jpg'; } else { $back = 'http://deluzion-gaming.net/pixelplushies/pets/erorr.jpg'; } $red = imagecolorallocate($back, 0, 0, 0); header ("Content-type: image/Jpeg"); $back = imagecreatefromjpeg ("$back"); $textcolor = ImageColorAllocate ($back, 000000, 000000, 000000); ImageString ($back, 2, 2, 2, "Pet Name: $pet_name", $textcolor); ImageString ($back, 2, 2, 13, "Pet Level: $level", $textcolor); ImageString ($back, 2, 2, 24, "Your IP: $realip", $textcolor); ImageString ($back, 2, 2, 13, "Your Broser: $browser", $textcolor); ImageGif ($back); ImageDestroy ($back); ?> When that is viewed on my web site (it has php gd) it just shows up like this: colorallocate($back, 0, 0, 0); header ("Content-type: image/Jpeg"); $back = imagecreatefromjpeg ("$back"); $textcolor = ImageColorAllocate ($back, 000000, 000000, 000000); ImageString ($back, 2, 2, 2, "Pet Name: $pet_name", $textcolor); ImageString ($back, 2, 2, 13, "Pet Level: $level", $textcolor); ImageString ($back, 2, 2, 24, "Your IP: $realip", $textcolor); ImageString ($back, 2, 2, 13, "Your Broser: $browser", $textcolor); ImageGif ($back); ImageDestroy ($back); ?> If anyone has any way they even think could fix this, I'd really appreciate a replay! Thank you for your time, Zack Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/ Share on other sites More sharing options...
BlueSkyIS Posted May 26, 2008 Share Posted May 26, 2008 for one, you need to double-quote strings if you're going to use a variable in them as you have: $back = "http://deluzion-gaming.net/pixelplushies/pets/1to25_$color.jpg"; otherwise, you'll get exactly what you single-quoted: http://deluzion-gaming.net/pixelplushies/pets/1to25_$color.jpg Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-550396 Share on other sites More sharing options...
zackcez Posted May 27, 2008 Author Share Posted May 27, 2008 Thanks, now there's still an error somewhere :s: Parse error: syntax error, unexpected $end in /homepages/43/d240520710/htdocs/pixelplushies/image.php on line 69 Line 69 is just: ?> lol Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-550519 Share on other sites More sharing options...
mushroom Posted May 27, 2008 Share Posted May 27, 2008 I have never seen else if with a space between them used successfully. be safe and use elseif Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-550522 Share on other sites More sharing options...
zackcez Posted May 28, 2008 Author Share Posted May 28, 2008 Hmm...Still doesn't work :s here is the page: http://pixel.deluzion-gaming.net/image.php?name=Test Thanks for the reply though..I'll leave it how you told me to also...just in case Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-551281 Share on other sites More sharing options...
DarkWater Posted May 28, 2008 Share Posted May 28, 2008 That error means that you missed a } somewhere. Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-551294 Share on other sites More sharing options...
zackcez Posted May 28, 2008 Author Share Posted May 28, 2008 Hmmm...Thanks, that helps a bit, but I'm not seeing WHERE it's mising :s. Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-551337 Share on other sites More sharing options...
zackcez Posted May 28, 2008 Author Share Posted May 28, 2008 FIXED , It was a pretty stupid error for me not to notice ; stopped working after I added the update, we'll leve it at that lolz Link to comment https://forums.phpfreaks.com/topic/107353-solved-php-gd-problem/#findComment-551341 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.