All pastes #394745 Raw Edit

Someone

public php v1 · immutable
·published 2007-03-14 15:25 UTC
rendered paste body
<?php $nav = $_SERVER["REQUEST_URI"];$script = $_SERVER["SCRIPT_NAME"];$nav = ereg_replace("^$script", "", $nav);$nav = str_replace("%20"," ",$nav);$vars = explode("/", $nav);$per = substr($vars[3],0,strpos($vars[3],"."));$stat = strtolower($vars[1]);$pgoal = strtolower($vars[2]);$per = ucfirst(strtolower($per));$handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".$per,"r"); if($handle){    while (!feof($handle)) {    $contents .= fread($handle, 8192);} fclose($handle);}function GetLvl($skill){	$str1 = strstr($GLOBALS['contents'], '>'.chr(10).$skill.chr(10).'<');	if(strpos($str1, 'd co')<30) return '--';	$pos1 = strpos($str1, 't"',strpos($str1, 't"')+1)+3;		return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);}		function GetXP($skill){	$str1 = strstr($GLOBALS['contents'], '>'.chr(10).$skill.chr(10).'<');	if(strpos($str1, 'd co')<30) return '--';	$pos1 = strpos($str1, 't"',strpos($str1, 't"',strpos($str1, 't"')+1)+1)+3; 	return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);}function GetRank($skill)	{	$str1 = strstr($GLOBALS['contents'], '>'.chr(10).$skill.chr(10).'<');	if(strpos($str1, 'd co')<30) return '--';	$pos1 = strpos($str1, 't"')+3; 	return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);} 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="./images/font1.ttf";if ($stat == 'runecrafting' ) {$lvl =  GetLvl(Runecraft);$xp  =  GetXP(Runecraft);} else {$lvl =  GetLvl(ucfirst(strtolower($stat)));$xp  =  GetXP(ucfirst(strtolower($stat)));}$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, 180, 13, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);imagettftext($im, 8, 0, 179, 12, $white, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);imagettftext($im, 8, 0, 180, 24, $black, $font, "Goal Achived!");imagettftext($im, 8, 0, 179, 23, $white, $font, "Goal Achived!");imagettftext($im, 10, 0, 70, 20, $black, $font, 'Goal Achived!');imagettftext($im, 10, 0, 70, 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, 31, 8, 0, 0, (0.444444*$percent)+$percent, 14);imagedestroy($im4);imagettftext($im, 8, 0, 180, 13, $black, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);imagettftext($im, 8, 0, 179, 12, $white, $font, ucfirst(strtolower($stat)).' lvl: '.$lvl.' / '.$pgoal);imagettftext($im, 8, 0, 180, 24, $black, $font, 'XP to go: '.number_format($temp));imagettftext($im, 8, 0, 179, 23, $white, $font, 'XP to go: '.number_format($temp));imagettftext($im, 10, 0, 90, 20, $black, $font, $percent.'%');imagettftext($im, 10, 0, 90, 19, $white, $font, $percent.'%');}//Paste image of statimagecopy($im, $im3, 0,0, 0, 0, 31, 29);imagedestroy($im3);header("Content-type: image/png");imagepng($im);imagedestroy($im);?>