;######################; ;###### stats.php #####; ;######################; \n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } } // if there is a user if ($user) { // get the data and put it in an array $site = file("http://hiscore.runescape.com/hiscorepersonal.ws?user1=".$user); $n = 0; while ($n <= 500) { $site[$n] = trim(strip_tags($site[$n])); $site[$n] = str_replace('Search by name','',$site[$n]); $site[$n] = str_replace('Search by rank','',$site[$n]); $site[$n] = str_replace('Compare Users','',$site[$n]); $n++; } if (!$_GET['mode']) { // while loop to rid the html in the key array values // while loop to output $o = 42; while ($o <= 260) { if ($site[$o+2] != "Not Ranked") { echo $site[$o] . ' ' . $site[$o+2] . ' ' . $site[$o+3] . ' ' . $site[$o+4] . ' ' . "\n"; $o = $o + 9; } else { echo $site[$o] . ' Not Ranked'.''."\n"; $o = $o + 7; } } } if ($_GET['mode']) { //Calculate Combat Level, Range Level, Mage Level, Class, etc... $attack_level = $site[194]; echo 'Attack: ' . $attack_level . "\n"; $defense_level = $site[203]; echo 'Defence: ' . $defense_level . "\n"; $strength_level = $site[212]; echo 'Strength: ' . $strength_level . "\n"; $range_level = $site[230]; echo 'Range: ' . $range_level . "\n"; $magic_level = $site[248]; echo 'Magic: ' . $magic_level . "\n"; $prayer_level = $site[239]; echo 'Prayer: ' . $prayer_level . "\n"; $hitpoints_level = $site[221]; echo 'Hitpoints: ' . $hitpoints_level . "\n"; $cmblvl = (0.32707*$attack_level)+(0.249*$defense_level)+(0.324*$strength_level)+(0.25*$hitpoints_level)+(0.124*$prayer_level); $rangelvl = (0.487*$range_level)+(0.249*$defense_level)+(0.25*$hitpoints_level)+(0.124*$prayer_level); $magelvl = (0.487*$magic_level)+ (0.249*$defense_level)+(0.25*$hitpoints_level)+(0.124*$prayer_level); if($cmblvl > $magelvl AND $cmblvl > $rangelvl) { $class = Warrior; } elseif($rangelvl > $magelvl AND $rangelvl > $cmblvl) { $class = Ranger; $cmblvl = $rangelvl; } elseif($magelvl > $cmblvl AND $magelvl > $rangelvl) { $class = Mager; $cmblvl = $magelvl; } else { $class = Warrior; } echo "Combat: $cmblvl\n", "Class: $class\n"; /* ATT DEF STR HP RNG MAGE PRAY */ if ($class = Warrior) { $attlvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.32707 ); $deflvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.249 ); $strlvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.324 ); $hplvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.25 ); $praylvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.124 ); echo "att: $attlvls\ndef: $deflvls\nstr: $strlvls\nhp: $hplvls\nrng: 0\nmage: 0\npray: $praylvls\n"; } elseif ($class = Ranger) { $rnglvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.487 ); $deflvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.249 ); $strlvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.324 ); $hplvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.25 ); $praylvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.124 ); echo "att: 0\ndef: $deflvls\nstr: 0\nhp: $hplvls\nrng: $rnglvls\nmage: 0\npray: $praylvls\n"; } elseif ($class = Mage) { $magelvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.487 ); $deflvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.249 ); $strlvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.324 ); $hplvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.25 ); $praylvls = ceil( (ceil($cmblvl) - $cmblvl) / 0.124 ); echo "att: 0\ndef: $deflvls\nstr: 0\nhp: $hplvls\nrng: 0\nmage: $magelvls\nprayer: $praylvls\n"; } } } else { echo 'You must supply a user!'; } echo "END\n"; ?> ©2006-2007 Open Source Software, Organization Website
Code used with permission; edited with permission.
All Rights Reserved to OSS, Org. Usage of this parser is a privelage, not a right. ;#####################; ;#### compare.php ####; ;#####################; ')) AND (stristr($compare[224],''))) { echo $user1 . ' and ' . $user2 . ' are not in the hi-scores for '.$skill.' END'; exit; } if (stristr($compare[214],'')) { echo $user1 . ' is not in the hi-scores for '.$skill.' END'; exit; } if (stristr($compare[224],'')) { echo $user2 . ' is not in the hi-scores for '.$skill.' END'; exit; } if ((stristr($compare[$check],'ranked')) AND (stristr($compare[$check+7],'ranked'))) { echo $user1 . ' and ' . $user2 . ' are not in the hi-scores for '.$skill.' END'; exit; } if (stristr($compare[$check],'ranked')) { echo $user1 . ' is not in the hi-scores for '.$skill. ' END'; exit; } if (stristr($compare[$check+7],'ranked')) { echo $user2 . ' is not in the hi-scores for '.$skill.' END'; exit; } break; } $x++; } if (str_replace(",","",trim(strip_tags($compare[$choice+1]))) > str_replace(",","",trim(strip_tags($compare[$choice+11])))) { $winner = '1'; $eval = str_replace(",","",trim(strip_tags($compare[$choice]))) - str_replace(",", "",trim(strip_tags($compare[$choice+10]))); $eval2 = str_replace(",","",trim(strip_tags($compare[$choice+1]))) - str_replace(",", "",trim(strip_tags($compare[$choice+11]))); } if (str_replace(",","",trim(strip_tags($compare[$choice+1]))) < str_replace(",","",trim(strip_tags($compare[$choice+11])))) { $winner = '0'; $eval = str_replace(",","",trim(strip_tags($compare[$choice+10]))) - str_replace(",","",trim(strip_tags($compare[$choice]))); $eval2 = str_replace(",","",trim(strip_tags($compare[$choice+11]))) - str_replace(",","",trim(strip_tags($compare[$choice+1]))); } if (str_replace(",","",trim(strip_tags($compare[$choice]))) == str_replace(",","",trim(strip_tags($compare[$choice+11])))) { $winner = '='; $eval = 'same'; $eval2 = 'same'; } echo trim(strip_tags($compare[$choice])) . ' ' . trim(strip_tags($compare[$choice+10])) . ' ' . $winner . ' ' . $eval . ' ' . $eval2 . ' END'; ?>