Codice PHP:
<?php
include("core.php");
include("config.php");
include("xhtmlfunctions.php");
connectdb();
$pid = $_GET["pid"];
$uid = getuid_sid($sid);
$sid = $_GET["sid"];
$stitle = htmlspecialchars(getstitle());
$sdomain = htmlspecialchars(getsdomain());
$date = htmlspecialchars(getdate2());
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$pstyle = gettheme($sid);
echo xhtmlhead("$stitle",$pstyle);
echo "<title>$sitename Mobile</title>";
echo "<body>";
echo "<p align=\"center\">";
echo "Non sei loggato<br/>";
echo "O la tua sessione è scaduta<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
$cnt = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_tamagotchi WHERE id='".$pid."'"));
if($cnt[0]==0||$pid==""||$pid==0)
{
$pet = "imgpet/no.gif";
$msg = "Missing Pet!";
$name = "No Name!";
$size = "2";
$x = "10";
$y = "30";
$a = "22";
$b = "41";
$eyes = imagecreatefromgif($pet);
$text_colour = imagecolorallocate( $eyes, 0, 0, 0 );
imagestring( $eyes, $size, $x, $y, $msg, $text_colour );
imagestring( $eyes, $size, $a, $b, $name, $text_colour );
header("Content-type: image/gif");
imagegif($eyes);
imagecolordeallocate( $text_color );
imagedestroy( $eyes );
exit();
}else{
$in = mysql_fetch_array(mysql_query("SELECT level, name, sex FROM ibwf_tamagotchi WHERE id='".$pid."'"));
if($in[0]=='1'||$in[0]<5)
{
if($in[2]=='F')
{
$pet = "imgpet/2.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "38";
$a = "21";
$b = "48";
}else{
$pet = "imgpet/1.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "23";
$y = "38";
$a = "23";
$b = "48";
}
}else if($in[0]=='5'||$in[0]<10)
{
if($in[2]=='F')
{
$pet = "imgpet/3.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "45";
$a = "21";
$b = "55";
}else{
$pet = "imgpet/3.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "45";
$a = "21";
$b = "55";
}
}else if($in[0]=='10'||$in[0]<15)
{
if($in[2]=='F')
{
$pet = "imgpet/4.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}else{
$pet = "imgpet/4.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}
}else if($in[0]=='15'||$in[0]<20)
{
if($in[2]=='F')
{
$pet = "imgpet/5.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}else{
$pet = "imgpet/5.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}
}else if($in[0]=='20'||$in[0]<25)
{
if($in[2]=='F')
{
$pet = "imgpet/6.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "58";
$a = "21";
$b = "68";
}else{
$pet = "imgpet/7.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "60";
$a = "21";
$b = "70";
}
}else if($in[0]=='25'||$in[0]<30)
{
if($in[2]=='F')
{
$pet = "imgpet/9.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "53";
$a = "21";
$b = "63";
}else{
$pet = "imgpet/8.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "55";
$a = "21";
$b = "65";
}
}else if($in[0]=='30'||$in[0]<35)
{
if($in[2]=='F')
{
$pet = "imgpet/11.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "53";
$a = "21";
$b = "63";
}else{
$pet = "imgpet/10.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "55";
$a = "21";
$b = "65";
}
}else if($in[0]=='35'||$in[0]<40)
{
if($in[2]=='F')
{
$pet = "imgpet/13.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "58";
$a = "21";
$b = "68";
}else{
$pet = "imgpet/12.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "60";
$a = "21";
$b = "70";
}
}else if($in[0]=='40'||$in[0]<45)
{
if($in[2]=='F')
{
$pet = "imgpet/15.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "58";
$a = "21";
$b = "68";
}else{
$pet = "imgpet/14.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "55";
$a = "21";
$b = "65";
}
}else if($in[0]=='45'||$in[0]<50)
{
if($in[2]=='F')
{
$pet = "imgpet/17.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "53";
$a = "21";
$b = "63";
}else{
$pet = "imgpet/16.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}
}else if($in[0]=='50'||$in[0]<55)
{
if($in[2]=='F')
{
$pet = "imgpet/19.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "53";
$a = "21";
$b = "63";
}else{
$pet = "imgpet/18.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "50";
$a = "21";
$b = "60";
}
}else if($in[0]=='55'||$in[0]<100)
{
if($in[2]=='F')
{
$pet = "imgpet/21.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "53";
$a = "21";
$b = "63";
}else{
$pet = "imgpet/20.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "55";
$a = "21";
$b = "65";
}
}else if($in[0]=='100'||$in[0]>100)
{
if($in[2]=='F')
{
$pet = "imgpet/23.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "15";
$y = "60";
$a = "15";
$b = "70";
}else{
$pet = "imgpet/22.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "15";
$y = "55";
$a = "15";
$b = "65";
}
}else if($in[0]=='0')
{
if($in[2]=='F')
{
$pet = "imgpet/2.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "21";
$y = "38";
$a = "21";
$b = "48";
}else{
$pet = "imgpet/1.gif";
$msg = "Level: $in[0]";
$name = $in[1];
$size = "2";
$x = "23";
$y = "38";
$a = "23";
$b = "48";
}
}else{
$pet = "imgpet/no.gif";
$msg = "Missing Pet!";
$name = "No Name!";
$size = "2";
$x = "10";
$y = "30";
$a = "22";
$b = "41";
}
$eyes = imagecreatefromgif($pet);
$text_colour = imagecolorallocate( $eyes, 0, 0, 0 );
imagestring( $eyes, $size, $x, $y, $msg, $text_colour );
imagestring( $eyes, $size, $a, $b, $name, $text_colour );
header("Content-type: image/gif");
imagegif($eyes);
imagecolordeallocate( $text_color );
imagedestroy( $eyes );
}
?>