What do i need to learn for...or modifiy the old code
Moderator: General Moderators
-
gaogier
- Forum Contributor
- Posts: 391
- Joined: Wed Mar 02, 2005 1:02 pm
- Location: Portsmouth, UK
- Contact:
What do i need to learn for...or modifiy the old code
I am trying to gather information from http://www.rsclegacy.com/. How does one go about that...I need access to the client somehow.
Last edited by gaogier on Sun Jun 04, 2017 11:25 pm, edited 1 time in total.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
- http://php.net/ref.image
- http://php.net/ref.curl, fsockopen() and/or things like Snoopy.
- See 2.
- See 1.
- See 1.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: What do i need to learn for...or modifiy the old code
cURL and GD library should do the trick.
-
gaogier
- Forum Contributor
- Posts: 391
- Joined: Wed Mar 02, 2005 1:02 pm
- Location: Portsmouth, UK
- Contact:
I do have this code, but, how can i get rid of the errors?
Also, there are a few new skills. I thought, this would save me some time.
and there are some errors,
My prevous attempts to do this from scratch, lands up like this...
Code: Select all
<?php
include('header.inc');
class score_table
{
var $page;
var $parser;
var $scoretable;
function score_table ($page, $parser)
{
$this->page = $page;
$this->parser = $parser;
$this->scoretable = array();
}
function load_table ()
{
if (($page = $this->page->load_page()) === false)
{
return false;
}
if (($scores = $this->parser->parse_page($page)) === false)
{
return false;
}
$this->scoretable = $scores;
$this->convert_int($this->page->get_int_list());
return true;
}
function convert_int ($list)
{
foreach ($list as $colum)
{
foreach ($this->scoretable[$colum] as $key => $value)
{
$this->scoretable[$colum][$key] = intval($value);
}
}
}
function get_row ($n)
{
if ($n < 0 || $n >= count($this->scoretable[$this->page->get_name_colum()]))
{
return false;
}
$array = array();
foreach ($this->scoretable as $key => $value)
{
$array[$key] = $value[$n];
}
return $array;
}
function search_row ($colum, $search)
{
if (!isset($this->scoretable[$colum]))
{
return false;
}
$search = str_replace(' ', '_', $search);
foreach($this->scoretable[$colum] as $key => $value)
{
if (strcasecmp(str_replace(' ', '_', $value), $search) == 0)
{
return $this->get_row($key);
}
}
return false;
}
function get_names ()
{
return array_values($this->scoretable[$this->page->get_name_colum()]);
}
function get_size ()
{
return count($this->scoretable[$this->page->get_name_colum()]);
}
function get_colums ()
{
return array_keys($this->scoretable);
}
}
class hiscore_page
{
var $url;
function hiscore_page ($url)
{
$this->url = $url;
}
function load_page ()
{
if (($page = file_get_contents($this->url)) === false)
{
return false;
}
return $page;
}
function get_name_colum ()
{
return 'Name';
}
function get_int_list ()
{
return array('Rank', 'Level', 'XP');
}
}
class personal_page extends hiscore_page
{
function personal_page ($name)
{
parent::hiscore_page('http://hiscore-web.runescape.com/aff/runescape/hiscorepersonal.cgi?username=' .
strtolower(str_replace(' ', '_', $name)));
}
function get_name_colum ()
{
return 'Skill';
}
}
class personal_parser
{
function parse_page ($page)
{
$table = preg_replace('/<td>(<img .* \/>| )<\/td>|<a .*>|<\/a>/Us', '', $table[0]);
preg_match('/<tr>(.*)<\/tr>/Us', $table, $match);
$colums = array();
$skills = array();
while (preg_match('/<td .*><b>(.*)<\/b><\/td>/Us', $match[1], $search))
{ $colums[] = $search[1];
$skills[$search[1]] = array();
$match[1] = str_replace($search[0], '', $match[1]);
}
$table = str_replace($match[0], '', $table);
$table = preg_replace('/[^a-zA-Z0-9<>\/]/', '', $table);
$row = 0;
while (preg_match('/<tr>(.*)<\/tr>/Us', $table, $skill))
{
$col = 0;
while (preg_match('/<td.*>(.*)<\/td>/Us', $skill[1], $search))
{
$skills[$colums[$col++]][$row] = $search[1];
$skill[1] = substr_replace($skill[1], '', strpos($skill[1], $search[0]), strlen($search[0]));
}
$table = substr_replace($table, '', strpos($table, $skill[0]), strlen($skill[0]));
$row += 1;
}
return $skills;
}
}
$name = $_SESSION['user_info'];
$scorepage = new score_table(new personal_page($name), new personal_parser());
if ($scorepage->load_table() === false)
{
echo 'Page failed to load, or no entry for '.$name.' was found';
exit;
}
$skill = "Attack";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$attack ="1";
$atcheck = "1";
$check = "1";
}else{
$attack = $row['Level'];
}
$skill = "Overall";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$overall ="1";
$ovcheck = "1";
$check = "1";
}else{
$overall = $row['Level'];
}
$skill = "Defence";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$defence = "1";
$decheck = "1";
$check = "1";
}else{
$defence = $row['Level'];
}
$skill = "Hitpoints";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$hitpoints ="1";
$hicheck = "1";
$check = "1";
}else{
$hitpoints = $row['Level'];
}
$skill = "Strength";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$strength ="1";
$stcheck = "1";
$check = "1";
}else{
$strength = $row['Level'];
}
$skill = "Magic";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$magic ="1";
$macheck = "1";
$check = "1";
}else{
$magic = $row['Level'];
}
$skill = "Prayer";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$prayer ="1";
$prcheck = "1";
$check = "1";
}else{
$prayer = $row['Level'];
}
$skill = "Mining";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$mining ="1";
$micheck = "1";
$check = "1";
}else{
$mining = $row['Level'];
}
$skill = "Smithing";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$smithing ="1";
$smcheck = "1";
$check = "1";
}else{
$smithing = $row['Level'];
}
$skill = "Slayer";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$slayer = "1";
$slcheck = "1";
$check = "1";
}else{
$slayer = $row['Level'];
}
$skill = "Runecrafting";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$runecrafting ="1";
$rucheck = "1";
$check = "1";
}else{
$runecrafting = $row['Level'];
}
$skill = "Cooking";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$cooking ="1";
$cocheck = "1";
$check = "1";
}else{
$cooking = $row['Level'];
}
$skill = "Fishing";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$fishing ="1";
$ficheck = "1";
$check = "1";
}else{
$fishing = $row['Level'];
}
$skill = "Ranged";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$ranged ="1";
$racheck = "1";
$check = "1";
}else{
$ranged = $row['Level'];
}
$skill = "Herblore";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$herblore ="1";
$hecheck = "1";
$check = "1";
}else{
$herblore = $row['Level'];
}
$skill = "Crafting";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$crafting ="1";
$crcheck = "1";
$check = "1";
}else{
$crafting = $row['Level'];
}
$skill = "Woodcutting";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$woodcutting = "1";
$wocheck = "1";
$check = "1";
}else{
$woodcutting = $row['Level'];
}
$skill = "Fletching";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$fletching = "1";
$flcheck = "1";
$check = "1";
}else{
$fletching = $row['Level'];
}
$skill = "Fishing";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$fishing = "1";
$ficheck = "1";
$check = "1";
}else{
$fishing = $row['Level'];
}
$skill = "Agility";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$agility = "1";
$agcheck = "1";
$check = "1";
}else{
$agility = $row['Level'];
}
$skill = "Thieving";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$thieving="1";
$thcheck = "1";
$check = "1";
}else{
$thieving = $row['Level'];
}
$skill = "Firemaking";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$firemaking = "1";
$fmcheck = "1";
$check = "1";
}else{
$firemaking = $row['Level'];
}
$skill = "Farming";
if (($row = $scorepage->search_row('Skill', $skill)) === false)
{
$farming = "1";
$farmcheck = "1";
$check = "1";
}else{
$farming = $row['Level'];
}
echo '
<form method="post" action="changestat.php">
<br />
<table width="89%" border="0">
<tr>
<td><font class="text"><b>'.$name.'</font></b><font class="small2"> - you don\'t have some stats in the database. Could you fill them in please.</center><input type="hidden" name="name" value="'.$name.'"></td>
</tr>
<tr>
<td><table border="1">';
if ($check == "1"){
if ($ovcheck == "1"){
echo '
<tr>
<td ><font class="small">Overall</font></td>
<td><font class="small"><input type="text" name="overall" value="'.$overall.'" class="text"></td>
</tr>';
}
if ($atcheck == "1"){
echo '
<tr>
<td ><font class="small">Attack</font></td>
<td><font class="small"><input type="text" name="attack" value="'.$attack.'" class="text"></td>
</tr>';
}
if ($decheck == "1"){
echo '
<tr>
<td ><font class="small">Defence</font></td>
<td><font class="small"><input type="text" name="defence" value="'.$defence.'" class="text"></td>
</tr>';
}
if ($stcheck == "1"){
echo '
<tr>
<td ><font class="small">Strength</font></td>
<td><font class="small"><input type="text" name="strength" value="'.$strength.'" class="text"></td>
</tr>';
}
if ($hicheck == "1"){
echo '
<tr>
<td ><font class="small">Hitpoints</font></td>
<td><font class="small"><input type="text" name="hitpoints" value="'.$hitpoints.'" class="text"></td>
</tr>';
}
if ($racheck == "1"){
echo '
<tr>
<td ><font class="small">Ranged</font></td>
<td><font class="small"><input type="text" name="ranged" value="'.$ranged.'" class="text"></td>
</tr>';
}
if ($prcheck == "1"){
echo '
<tr>
<td ><font class="small">Prayer</font></td>
<td><font class="small"><input type="text" name="prayer" value="'.$prayer.'" class="text"></td>
</tr>';
}
if ($macheck == "1"){
echo '
<tr>
<td ><font class="small">Magic</font></td>
<td><font class="small"><input type="text" name="magic" value="'.$magic.'" class="text"></td>
</tr>';
}
if ($cocheck == "1"){
echo '
<tr>
<td ><font class="small">Cooking</font></td>
<td><font class="small"><input type="text" name="cooking" value="'.$cooking.'" class="text"></td>
</tr>';
}
if ($wocheck == "1"){
echo '
<tr>
<td ><font class="small">Woodcutting</font></td>
<td><font class="small"><input type="text" name="woodcutting" value="'.$woodcutting.'" class="text"></td>
</tr>';
}
if ($flcheck == "1"){
echo '
<tr>
<td ><font class="small">Fletching</font></td>
<td><font class="small"><input type="text" name="fletching" value="'.$fletching.'" class="text"></td>
</tr>';
}
if ($ficheck == "1"){
echo '
<tr>
<td ><font class="small">Fishing</font></td>
<td><font class="small"><input type="text" name="fishing" value="'.$fishing.'" class="text"></td>
</tr>';
}
if ($fmcheck == "1"){
echo '
<tr>
<td ><font class="small">Firemaking</font></td>
<td><font class="small"><input type="text" name="firemaking" value="'.$firemaking.'" class="text"></td>
</tr>';
}
if ($crcheck == "1"){
echo '
<tr>
<td ><font class="small">Crafting</font></td>
<td><font class="small"><input type="text" name="crafting" value="'.$crafting.'" class="text"></td>
</tr>';
}
if ($smcheck == "1"){
echo '
<tr>
<td ><font class="small">Smithing</font></td>
<td><font class="small"><input type="text" name="smithing" value="'.$smithing.'" class="text"></td>
</tr>';
}
if ($micheck == "1"){
echo '
<tr>
<td ><font class="small">Mining</font></td>
<td><font class="small"><input type="text" name="mining" value="'.$mining.'" class="text"></td>
</tr>';
}
if ($hecheck == "1"){
echo '
<tr>
<td ><font class="small">Herblore</font></td>
<td><font class="small"><input type="text" name="herblore" value="'.$herblore.'" class="text"></td>
</tr>';
}
if ($agcheck == "1"){
echo '
<tr>
<td ><font class="small">Agility</font></td>
<td><font class="small"><input type="text" name="agility" value="'.$agility.'" class="text"></td>
</tr>';
}
if ($thcheck == "1"){
echo '
<tr>
<td ><font class="small">Thieving</font></td>
<td><font class="small"><input type="text" name="thieving" value="'.$thieving.'" class="text"></td>
</tr>';
}
if ($slcheck == "1"){
echo '
<tr>
<td ><font class="small">Slayer</font></td>
<td><font class="small"><input type="text" name="slayer" value="'.$slayer.'" class="text"></td>
</tr>';
}
if ($rucheck == "1"){
echo '
<tr>
<td ><font class="small">Runecrafting</font></td>
<td><font class="small"><input type="text" name="runecrafting" value="'.$runecrafting.'" class="text"></td>
</tr>';
}
if ($farmcheck == "1"){
echo '
<tr>
<td ><font class="small">Farming</font></td>
<td><font class="small"><input type="text" name="farming" value="'.$farming.'" class="text"></td>
</tr>';
}
}
echo '
<tr>
<td ><font class="small">Quest Points</font></td>
<td><font class="small"><input type="text" name="questpoints" value="" class="text"></td>
</tr>
<tr>
<td ><font class="small">Combat Level</font></td>
<td><font class="small"><input type="text" name="combat" value="" class="text"></td>
</tr>
</table></td>
</tr>
</table>';
echo '
<input type="radio" name="back" value="legend.png">
<img src="Dsigs/legend.png"></label>';
/* <br />
<input type="radio" name="back" value="sig1.jpg">
<img src="Dsigs/sig1.jpg"></label>
<br />
<label>
<input type="radio" name="back" value="Image11.jpg">
<img src="Dsigs/Image11.jpg"></label>
<br />
<label>
<input type="radio" name="back" value="flaxdsig.jpg">
<img src="Dsigs/flaxdsig.jpg"></label><br />
<label>
<input type="radio" name="back" value="fishingdsig.jpg">
<img src="Dsigs/fishingdsig.jpg"></label><br />';
<label>
<input type="radio" name="back" value="dragonbg.jpg">
<img src="Dsigs/dragonbg.jpg"></label><br />
';
<label>
<input type="radio" name="back" value="fallycenter.jpg">
<img src="Dsigs/fallycenter.jpg"></label><br />
<label>
<input type="radio" name="back" value="fishingguild.jpg">
<img src="Dsigs/fishingguild.jpg"></label><br />
<label>
<input type="radio" name="back" value="flax.jpg">
<img src="Dsigs/flax.jpg"></label><br />
<label>
<input type="radio" name="back" value="lumbridge.jpg">
<img src="Dsigs/lumbridge.jpg"></label><br />
<label>
<input type="radio" name="back" value="partyroom.jpg">
<img src="Dsigs/partyroom.jpg"></label><br />
<label>
<input type="radio" name="back" value="portsarim.jpg">
<img src="Dsigs/portsarim.jpg"></label><br />
<label>
<input type="radio" name="back" value="rimmington.jpg">
<img src="Dsigs/rimmington.jpg"></label><br />
<label>
<input type="radio" name="back" value="rubberchicken.jpg">
<img src="Dsigs/rubberchicken.jpg"></label><br />
<label>
<input type="radio" name="back" value="varocksquare.jpg">
<img src="Dsigs/varocksquare.jpg"></label><br />
<label>
<input type="radio" name="back" value="wizardstower.jpg">
<img src="Dsigs/wizardstower.jpg"></label><br />*/
echo '
<br /><input name="post" type="submit" value="Change Stats" class="text"></form><br /><br /><font clas="small2">Please note only those stats we were unable to pull from the hi-scores are writable. All others are dynamically generated.<br /><br />';
//echo '<img src="Dsigs/dsig.php?name='.$name.'" border="0">';
//echo '<p class="small">Code (copy this into your signiture on the forums):<br /> [img]http://runehints.com/Dsigs/'.$name.'.png[/img]';
include('footer.inc');
?>Also, there are a few new skills. I thought, this would save me some time.
and there are some errors,
And i think it uses the old way to get the data from the hiscores, now the script is updated, it needs to get linked to the new way.Warning: Invalid argument supplied for foreach() in /home/gaogier/public_html/createsig.php on line 32
Warning: Invalid argument supplied for foreach() in /home/gaogier/public_html/createsig.php on line 32
Warning: Invalid argument supplied for foreach() in /home/gaogier/public_html/createsig.php on line 32
My prevous attempts to do this from scratch, lands up like this...
‰PNG ��� IHDR��,���d���³cš—�� �IDATxœì½kÐmÙU6Æ\kïóø¾ûìÛ·»%YaJ²ƒ0%ø
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm