Code:
<?php
$nav = $_SERVER["REQUEST_URI"];
$script = $_SERVER["SCRIPT_NAME"];
$nav = ereg_replace("^$script", "", $nav);
$nav = str_replace("%20"," ",$nav);
$vars = explode("/", $nav);
$per1 = substr($vars[3],0,strpos($vars[3],"."));
$stat = strtolower($vars[1]);
$pgoal = strtolower($vars[2]);
$per = ucfirst(strtolower($per1));
function getExperience($exp, $goal){
$goal--;
for($i = 1; $i <= $goal; $i++){
$e += intval($i + 300 * pow(2, $i / 7));
}
return intval($e / 4) - $exp;
}
function getPercent($exp, $goal){
$goal--;
for($i = 1; $i <= $goal; $i++){
$e += intval($i + 300 * pow(2, $i / 7));
}
return round(($exp / intval($e / 4)) * 100 ,0);
}
$font="font.ttf";
$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);
$sql = "SELECT * FROM users WHERE playerName='$per'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$attack = $row["Attacklvl"];
$defence = $row["Defencelvl"];
$strength = $row["Strengthlvl"];
$hitpoints = $row["Hitpointslvl"];
$range = $row["Rangelvl"];
$prayer = $row["Prayerlvl"];
$magic = $row["Magiclvl"];
$cooking = $row["Cookinglvl"];
$woodcutting = $row["Woodcuttinglvl"];
$fletching = $row["Fletchinglvl"];
$fishing = $row["Fishinglvl"];
$firemaking = $row["Firemakinglvl"];
$mining = $row["Mininglvl"];
$herblore = $row["Herblorelvl"];
$agility = $row["Agilitylvl"];
$thieving = $row["Thievinglvl"];
$slayer = $row["Slayerlvl"];
$runecrafting = $row["Runecraftinglvl"];
$AttackXp = $row["Attackxp"];
$DefenceXp = $row["Defencexp"];
$StrengthXp = $row["Strengthxp"];
$HitpointsXp = $row["Hitpointsxp"];
$RangeXp = $row["Rangexp"];
$PrayerXp = $row["Prayerxp"];
$MagicXp = $row["Magicxp"];
$CookingXp = $row["Cookingxp"];
$WoodcuttingXp = $row["Woodcuttingxp"];
$FletchingXp = $row["Fletchingxp"];
$FishingXp = $row["Fishingxp"];
$FiremakingXp = $row["Firemakingxp"];
$MiningXp = $row["Miningxp"];
$HerbloreXp = $row["Herblorexp"];
$AgilityXp = $row["Agilityxp"];
$ThievingXp = $row["Thievingxp"];
$SlayerXp = $row["SlayerXp"];
$RunecraftingXp = $row["Runecraftingxp"];
if ($stat == 'attack' ) {
$lvl = $attack;
$xp = $AttackXp;
} elseif($stat == 'defence'){
$lvl = $defence;
$xp = $DefenceXp;
} elseif($stat == 'strength'){
$lvl = $strength;
$xp = $StrengthXp;
} elseif($stat == 'hitpoints'){
$lvl = $hitpoints;
$xp = $HitpointsXp;
} elseif($stat == 'range'){
$lvl = $range;
$xp = $RangeXp;
} elseif($stat == 'prayer'){
$lvl = $prayer;
$xp = $PrayerXp;
} elseif($stat == 'magic'){
$lvl = $magic;
$xp = $MagicXp;
} elseif($stat == 'cooking'){
$lvl = $cooking;
$xp = $CookingXp;
} elseif($stat == 'woodcutting'){
$lvl = $woodcutting;
$xp = $WoodcuttingXp;
} elseif($stat == 'fletching'){
$lvl = $fletching;
$xp = $FletchingXp;
} elseif($stat == 'fishing'){
$lvl = $fishing;
$xp = $FishingXp;
} elseif($stat == 'firemaking'){
$lvl = $firemaking;
$xp = $FiremakingXp;
} elseif($stat == 'mining'){
$lvl = $mining;
$xp = $MiningXp;
} elseif($stat == 'herblore'){
$lvl = $herblore;
$xp = $HerbloreXp;
} elseif($stat == 'agility'){
$lvl = $agility;
$xp = $AgilityXp;
} elseif($stat == 'thieving'){
$lvl = $thieving;
$xp = $ThievingXp;
} elseif($stat == 'slayer'){
$lvl = $slayer;
$xp = $SlayerXp;
} elseif($stat == 'runecrafting'){
$lvl = $runecrafting;
$xp = $RunecraftingXp;
}
$xp = str_replace(",","",$xp);
$temp = getExperience($xp, $pgoal);
if ($temp < 0 ) {
$imgfile = './images/100.png';
$imgfile2 = './images/'.$stat.'.png';
$im_size = getimagesize($imgfile);
$image_width = $im_size[0];
$image_height = $im_size[1];
$im = imagecreatetruecolor($image_width, $image_height);
$im2 = imagecreatefrompng($imgfile);
$im3 = imagecreatefrompng($imgfile2);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagecopy($im, $im2, 0, 0, 0, 0, $image_width, $image_height);
imagedestroy($im2);
imagettftext($im, 8, 0, 205, 18, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);
imagettftext($im, 8, 0, 75, 19, $white, $font, "Goal Achived!");
} else {
$imgfile = './images/main.png';
$imgfile2 = './images/'.$stat.'.png';
$bar = './images/bar.png';
$im_size = getimagesize($imgfile);
$image_width = $im_size[0];
$image_height = $im_size[1];
$im = imagecreatetruecolor($image_width, $image_height);
$im2 = imagecreatefrompng($imgfile);
$im3 = imagecreatefrompng($imgfile2);
$im4 = imagecreatefrompng($bar);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagecopy($im, $im2, 0, 0, 0, 0, $image_width, $image_height);
imagedestroy($im2);
$percent = getPercent($xp, $pgoal);
if ( $percent > 99) { $percent = 99; }
if ( $percent < 0) { $percent = 0; }
imagecopy($im, $im4, 55, 8, 0, 0, (0.444444*$percent)+$percent, 14);
imagedestroy($im4);
imagettftext($im, 8, 0, 205, 13, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);
imagettftext($im, 8, 0, 205, 24, $black, $font, 'XP to go: '.number_format($temp));
imagettftext($im, 9, 0, 100, 20, $white, $font, $percent.'%');
}
imagecopy($im, $im3, 15, 2, 0, 0, 25, 29);
imagedestroy($im3);
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
Save that as goalsig.php