Jump to content

Recommended Posts

Well, I have this code and there's a few things I want added to it, and I'm currently having some trubbles with it.

<?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 loaded the page just shows 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);
?> 

 

I'd also like to make it so if the user isn't found in the database it shows and error, which I've atempted as you can see in the code above, but it doesn't work...I'd also like to make it so the image can be view like... http://myurl.com/directory/name.jpg instead of having the .php; because most major forum softwares don't allow that :o.  Any help is appreciated!

Link to comment
https://forums.phpfreaks.com/topic/107349-a-few-problems/
Share on other sites

1) please use a more descriptive topic than "A Few Problems"

2) please do not ask multiple questions at a time like that, as it just adds to the confusion and also makes it look suspiciously close to wanting us to do your work for you.

 

Thread closed.  Please try again.

 

p.s.- I edited your post and took out your db info. That's not something you really want to be posting for the world to see.

Link to comment
https://forums.phpfreaks.com/topic/107349-a-few-problems/#findComment-550385
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.