jammie6789 Posted November 10, 2012 Share Posted November 10, 2012 (edited) <?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 November 10, 2012 by jammie6789 Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/ Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 What's wrong with what? You have provided no details as to what's wrong, or any errors. Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391522 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 I expected youd go to the site its on... ]Parse error[/b]: syntax error, unexpected '}' in /home/a5612301/public_html/signature.php on line 157 Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391523 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 Add an opening bracket after if isset post submit Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391524 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 It removed the error, but now it wont work Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391525 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 You aren't giving a name to your submit button add name="submit" Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391526 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 Where do i put that??? Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391527 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 (edited) <input type="submit" value="Submit" name="submit" /> Also before it becomes an issue, your form action I'm not seeing where you are getting your variables from for it and you are not escaping $img correctly Edited November 10, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391528 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 This really confusing me... Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391529 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 (edited) 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 November 10, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391530 Share on other sites More sharing options...
berridgeab Posted November 10, 2012 Share Posted November 10, 2012 You need to add a name to your sumbit button otherwise the 'submit' key won't exist in the $_POST array. Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391531 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 Shouldnt <form action="img.php?user=" .$user. "&img=". $img" method="post"> Be: <form action="signature.php?user=" .$user. "&img=". $img" method="post"> Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391534 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 (edited) I'm not sure what you're trying to accomplish but $img is not right in it either way Edited November 10, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391535 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391536 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 <form action="img.php?user=" .$user. "&img=" .$img. "" method="post"> Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391537 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 i mean like what would go on the file "img.php" Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391540 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 I have no idea what you're trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391542 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 like seriously, the signature.php file is done, but what do i put on the img.php file? as seen here, it goes to img.php after "submit" <form action="img.php?user=" .$user. "&img=" .$img. "" method="post"> Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391543 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 You need to explain what img.php does. We're here guessing blindly while there's no information as what you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391544 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 (edited) It displays this image: but with their runescape stats on Edited November 10, 2012 by jammie6789 Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391545 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 You would need direct access to runescape servers (to be able to get their stats) which they may not allow. Contact them first before attempting. You would also need to have some sort of script to constantly update the image for each user Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391546 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 OH OH OH IV WORKED IT OUT..... Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391547 Share on other sites More sharing options...
jammie6789 Posted November 10, 2012 Author Share Posted November 10, 2012 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391549 Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 (edited) Any errors? The only thing that I can see from a quick glance is that you may not be specifing the $_GET['username'] Edited November 10, 2012 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/270538-runescape-stat-signature-help/#findComment-1391550 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.