Jump to content

Runescape Stat Signature Help


jammie6789

Recommended Posts

<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<form action="img.php?user=" .$user. "&img=". $img" method="post">
<input name="user" type="text" />
<select name="img">
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="purple">Purple</option>
<option value="pink">Pink</option>
</select>
<input type="submit" value="Submit" />
</form>

<?php
if(isset($_POST['submit']))
$user = $_POST['user'];
$img = $_POST['img'];

//Skill Grabs
$order = array("Overall",
				 "Attack",
				 "Defence",
				 "Strength",
				 "Hitpoints",
				 "Ranged",
				 "Prayer",
				 "Magic",
				 "Cooking",
				 "Woodcutting",
				 "Fletching",
				 "Fishing",
				 "Firemaking",
				 "Crafting",
				 "Smithing",
				 "Mining",
				 "Herblore",
				 "Agility",
				 "Thieving",
				 "Slayer",
				 "Farming",
				 "Runecraft",
				 "Hunter",
				 "Construction",
				 "Summoning",
				 "Dungeoneering");

$user = $_GET['user']; //Change this to the variable (Or a string literal) that contains the username
$get = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user");
$get = explode("\n", $get);
$i = 0;

foreach ($order as $key => $value)
{
 $value = strtolower($value);
 $temp = explode(",", $get[$i]);
 $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]);
 $stats[$value] = $temp;
 $eval = "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);";
 eval($eval);
 $i++;
}

//End Skill Grabs

// specify the file name - you can use a full path, or "../../" type stuff here
// if the image is not in the same directory as this code file
$image = imagecreatefrompng("http://xpcentralrs.co.uk/hiscores/signatures/".$_GET['img'].".png");

// specify the font size


// in this case, the color is white, but you can replace the numbers with the RGB values
// of any color you want
$color = imagecolorallocate($image, 255,255,255);


// and now we do the overlay - the layers of text start top to bottom, so
// the drop shadow comes first

// $image - the base image file we specified above
// $font_size - Well duh. Its the size of the font
// 0 - the angle of the text - we don't want an angle, so we leave it at 0
// 55 - pixels to the right from the leftmost part of the image
// 35 - pixels down from the top of the image
// $black - the color we defined above
// "../fonts/ARIALBD.TTF" - the location on the server that the font can be found
// "Test Text" - the text we're overlaying - you can also use a variable here

ImageTTFText ($image, "7", 0, 280, 10, $color, "arial.ttf","XP CENTRAL");

ImageTTFText ($image, "12", 0, 240, 55, $color, "arial.ttf",$user);

if($overall[0]==-1){ImageTTFText($image, "11", 0, 230, 105, $color, "arial.ttf","NOT RANKED");}else{ImageTTFText($image, "11", 0, 240, 105, $color, "arial.ttf",$overall[0]);}

ImageTTFText ($image, "10", 0, 27, 20, $color, "arial.ttf",$attack[1]);
ImageTTFText ($image, "10", 0, 27, 42, $color, "arial.ttf",$strength[1]);
ImageTTFText ($image, "10", 0, 27, 64, $color, "arial.ttf",$defence[1]);
ImageTTFText ($image, "10", 0, 27, 88, $color, "arial.ttf",$hitpoints[1]);
ImageTTFText ($image, "10", 0, 27, 114, $color, "arial.ttf",$ranged[1]);

ImageTTFText ($image, "10", 0, 70, 20, $color, "arial.ttf",$prayer[1]);
ImageTTFText ($image, "10", 0, 70, 42, $color, "arial.ttf",$magic[1]);
ImageTTFText ($image, "10", 0, 70, 64, $color, "arial.ttf",$cooking[1]);
ImageTTFText ($image, "10", 0, 70, 88, $color, "arial.ttf",$woodcutting[1]);
ImageTTFText ($image, "10", 0, 70, 114, $color, "arial.ttf",$fletching[1]);

ImageTTFText ($image, "10", 0, 117, 20, $color, "arial.ttf",$fishing[1]);
ImageTTFText ($image, "10", 0, 117, 42, $color, "arial.ttf",$firemaking[1]);
ImageTTFText ($image, "10", 0, 117, 64, $color, "arial.ttf",$crafting[1]);
ImageTTFText ($image, "10", 0, 117, 88, $color, "arial.ttf",$smithing[1]);
ImageTTFText ($image, "10", 0, 117, 114, $color, "arial.ttf",$mining[1]);

ImageTTFText ($image, "10", 0, 162, 20, $color, "arial.ttf",$herblore[1]);
ImageTTFText ($image, "10", 0, 162, 42, $color, "arial.ttf",$agility[1]);
ImageTTFText ($image, "10", 0, 162, 64, $color, "arial.ttf",$thieving[1]);
ImageTTFText ($image, "10", 0, 162, 88, $color, "arial.ttf",$slayer[1]);
ImageTTFText ($image, "10", 0, 162, 114, $color, "arial.ttf",$farming[1]);

ImageTTFText ($image, "10", 0, 212, 20, $color, "arial.ttf",$runecraft[1]);
ImageTTFText ($image, "10", 0, 212, 42, $color, "arial.ttf",$construction[1]);
ImageTTFText ($image, "10", 0, 212, 64, $color, "arial.ttf",$hunter[1]);
ImageTTFText ($image, "10", 0, 212, 88, $color, "arial.ttf",$summoning[1]);
ImageTTFText ($image, "10", 0, 212, 114, $color, "arial.ttf",$dungeoneering[1]);

// Now add the actual white text "on top"

header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
}
?>

 

Whats wrong with that

 

LOCATED AT:

www.xpcentralrs.co.uk/signature.php

 

And to get someones stats at

 

www.xpcentralrs.co.uk/signature.php?user=NAME

 

Example:

www.xpcentralrs.co.uk/signature.php?user=kyahh

 

 

 

 

ALSO:

Im confused at this

form action="img.php?user=

 

shouldnt that be:

form action="signature.php?user=

Edited by jammie6789
Link to comment
Share on other sites

Everything that you post needs a name="" to identify it. by giving your submit button a name, the if(isset($_POST['submit'])) will work correctly.

 

Also after you solve the submit button crisis, change

<form action="img.php?user=" .$user. "&img=". $img" method="post">

to

<form action="img.php?user=" .$user. "&img=" .$img. "" method="post">

Edited by SocialCloud
Link to comment
Share on other sites

<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<form action="img.php?user=" .$user. "&img=". $img" method="post">
<input name="user" type="text" />
<select name="img">
<option value="blue" name="blue" >Blue</option>
<option value="red" name="red" >Red</option>
<option value="purple" name="purple ">Purple</option>
<option value="pink" name="pink" >Pink</option>
</select>
<input type="submit" value="Submit" name="Submit" />
</form>

<?php
if(isset($_POST['submit'])){
$user = $_POST['user'];
$img = $_POST['img'];

//Skill Grabs
$order = array("Overall",
									 "Attack",
									 "Defence",
									 "Strength",
									 "Hitpoints",
									 "Ranged",
									 "Prayer",
									 "Magic",
									 "Cooking",
									 "Woodcutting",
									 "Fletching",
									 "Fishing",
									 "Firemaking",
									 "Crafting",
									 "Smithing",
									 "Mining",
									 "Herblore",
									 "Agility",
									 "Thieving",
									 "Slayer",
									 "Farming",
									 "Runecraft",
									 "Hunter",
									 "Construction",
									 "Summoning",
									 "Dungeoneering");

$user = $_GET['user']; //Change this to the variable (Or a string literal) that contains the username
$get = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user");
$get = explode("\n", $get);
$i = 0;

foreach ($order as $key => $value)
{
	 $value = strtolower($value);
	 $temp = explode(",", $get[$i]);
	 $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]);
	 $stats[$value] = $temp;
	 $eval = "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);";
	 eval($eval);
	 $i++;
}

//End Skill Grabs

// specify the file name - you can use a full path, or "../../" type stuff here
// if the image is not in the same directory as this code file
$image = imagecreatefrompng("http://xpcentralrs.co.uk/hiscores/signatures/".$_GET['img'].".png");

// specify the font size


// in this case, the color is white, but you can replace the numbers with the RGB values
// of any color you want
$color = imagecolorallocate($image, 255,255,255);


// and now we do the overlay - the layers of text start top to bottom, so
// the drop shadow comes first

// $image - the base image file we specified above
// $font_size - Well duh. Its the size of the font
// 0 - the angle of the text - we don't want an angle, so we leave it at 0
// 55 - pixels to the right from the leftmost part of the image
// 35 - pixels down from the top of the image
// $black - the color we defined above
// "../fonts/ARIALBD.TTF" - the location on the server that the font can be found
// "Test Text" - the text we're overlaying - you can also use a variable here

ImageTTFText ($image, "7", 0, 280, 10, $color, "arial.ttf","XP CENTRAL");

ImageTTFText ($image, "12", 0, 240, 55, $color, "arial.ttf",$user);

if($overall[0]==-1){ImageTTFText($image, "11", 0, 230, 105, $color, "arial.ttf","NOT RANKED");}else{ImageTTFText($image, "11", 0, 240, 105, $color, "arial.ttf",$overall[0]);}

ImageTTFText ($image, "10", 0, 27, 20, $color, "arial.ttf",$attack[1]);
ImageTTFText ($image, "10", 0, 27, 42, $color, "arial.ttf",$strength[1]);
ImageTTFText ($image, "10", 0, 27, 64, $color, "arial.ttf",$defence[1]);
ImageTTFText ($image, "10", 0, 27, 88, $color, "arial.ttf",$hitpoints[1]);
ImageTTFText ($image, "10", 0, 27, 114, $color, "arial.ttf",$ranged[1]);

ImageTTFText ($image, "10", 0, 70, 20, $color, "arial.ttf",$prayer[1]);
ImageTTFText ($image, "10", 0, 70, 42, $color, "arial.ttf",$magic[1]);
ImageTTFText ($image, "10", 0, 70, 64, $color, "arial.ttf",$cooking[1]);
ImageTTFText ($image, "10", 0, 70, 88, $color, "arial.ttf",$woodcutting[1]);
ImageTTFText ($image, "10", 0, 70, 114, $color, "arial.ttf",$fletching[1]);

ImageTTFText ($image, "10", 0, 117, 20, $color, "arial.ttf",$fishing[1]);
ImageTTFText ($image, "10", 0, 117, 42, $color, "arial.ttf",$firemaking[1]);
ImageTTFText ($image, "10", 0, 117, 64, $color, "arial.ttf",$crafting[1]);
ImageTTFText ($image, "10", 0, 117, 88, $color, "arial.ttf",$smithing[1]);
ImageTTFText ($image, "10", 0, 117, 114, $color, "arial.ttf",$mining[1]);

ImageTTFText ($image, "10", 0, 162, 20, $color, "arial.ttf",$herblore[1]);
ImageTTFText ($image, "10", 0, 162, 42, $color, "arial.ttf",$agility[1]);
ImageTTFText ($image, "10", 0, 162, 64, $color, "arial.ttf",$thieving[1]);
ImageTTFText ($image, "10", 0, 162, 88, $color, "arial.ttf",$slayer[1]);
ImageTTFText ($image, "10", 0, 162, 114, $color, "arial.ttf",$farming[1]);

ImageTTFText ($image, "10", 0, 212, 20, $color, "arial.ttf",$runecraft[1]);
ImageTTFText ($image, "10", 0, 212, 42, $color, "arial.ttf",$construction[1]);
ImageTTFText ($image, "10", 0, 212, 64, $color, "arial.ttf",$hunter[1]);
ImageTTFText ($image, "10", 0, 212, 88, $color, "arial.ttf",$summoning[1]);
ImageTTFText ($image, "10", 0, 212, 114, $color, "arial.ttf",$dungeoneering[1]);

// Now add the actual white text "on top"

header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
}
?>

 

I have that now ^^

 

What should go on img.php :o:confused:

Link to comment
Share on other sites

<?php
$_POST['username'] = 'zezima';
$username = $_GET['username'];
    $username = strtolower(str_replace(' ', '_', $username));
$website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username);
$stats = explode("\n", $website);
$overall = explode(",", $stats[0]);
$stat['att'] = explode(",", $stats[1]);
$stat['def'] = explode(",", $stats[2]);
$stat['str'] = explode(",", $stats[3]);
$stat['hp'] = explode(",", $stats[4]);
$stat['rng'] = explode(",", $stats[5]);
$stat['pry'] = explode(",", $stats[6]);
$stat['mag'] = explode(",", $stats[7]);
$stat['ck'] = explode(",", $stats[8]);
$stat['wc'] = explode(",", $stats[9]);
$stat['flt'] = explode(",", $stats[10]);
$stat['fsh'] = explode(",", $stats[11]);
$stat['fm'] = explode(",", $stats[12]);
$stat['cra'] = explode(",", $stats[13]);
$stat['smi'] = explode(",", $stats[14]);
$stat['min'] = explode(",", $stats[15]);
$stat['her'] = explode(",", $stats[16]);
$stat['ag'] = explode(",", $stats[17]);
$stat['th'] = explode(",", $stats[18]);
$stat['sl'] = explode(",", $stats[19]);
$stat['frm'] = explode(",", $stats[20]);
$stat['rc'] = explode(",", $stats[21]);
$stat['hun'] = explode(",", $stats[22]);
$stat['cs'] = explode(",", $stats[23]);

$image_link = 'http://xpcentralrs.co.uk/stats.png';
$image = imagecreatefrompng($image_link);
//this is the font. You must include the filetype
$font = 'arial.ttf';
$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 10;
// x axis
//first number is x position for column 1
//second number is x position for cloumn 2
//third number is x position for column 3
//fourth number is x position for column 4
//fifth number is x position for column 5
$x = array('28', '80', '135', '188', '240');
// y axis
//first number is y position for row 1
//second number is y position for row 2
//third number is y position for row 3
//fourth number is y position for row 4
//fifth number is y position for row 5
$y = array('20', '45', '66', '90', '115');
$i = '0';
$a = '0';
foreach($stat as $s_key => $value){
    imagettftext($image, $font_size, 0, $x[$a], $y[$i], $font_colour, $font , $value[1]);
    $i++;
    if($i == '5'){
		    $i = '0';
		    $a++;
    }
}
imagettftext($image, $font_size, 0, '230', '100', $font_colour, $font , 'overall:' . $overall[1]);
imagettftext($image, $font_size, 0, '250', '120', $font_colour, $font , $username);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

 

whats wrong with that

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.