PDA

View Full Version : RS Highscore Help



Swinkid
29-10-2009, 12:09 AM
Literly, i coded this php highscore, someone enters a name on a diff page, and the highscore will appear on a diff page. If the user dosent have a highscore, it displays as "-1". How can i change it so insted of it appearing as "-1" is just says "-" using a if or something.

code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Runescape player highscore. Player: <?php echo $_POST["name"]; ?></title>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
color: #FFFFFF;
}
.style2 {color: #000000}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: #000000; }
-->
</style>
</head>

<body>

<table width="345" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td height="30" width="75" background="images/bar1.png"><div align="center" class="style1">Skill</div></td>
<td height="30" width="70" background="images/bar1.png"><div align="center" class="style1">Level</div></td>
<td height="30" width="106" background="images/bar1.png"><div align="center" class="style1">Rank</div></td>
<td height="30" width="76" background="images/bar1.png"><div align="center" class="style1">XP</div></td>
</tr>
<?php
$parse["config"]["username"] = $_POST["name"];
$parse["config"]["skills"] = array("Overall", "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting", "Hunter", "Construction", "Summoning");
$parse["config"]["minigames"] = array("Duel Tournament", "Bounty Hunters", "Bounty Hunter Rogues", "Fist of Guthix", "Mobilising Armies");
$parse["contents"] = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=" . $parse["config"]["username"]);
$parse["contents"] = explode("\n", $parse["contents"]);
foreach ($parse["contents"] AS $k => $v)
{

if (!empty($v))
{
if ((count($parse["contents"]) - count($parse["config"]["minigames"]) - 1) > $k)
{
$parse["temp"] = explode(",", $v);
echo("
<tr>
<td><div align=\"center\" class=\"style3\">" . $parse["config"]["skills"][$k] ." </div></td>
<td><div align=\"center\" class=\"style3\">" . $parse["temp"][1] . "</div></td>
<td><div align=\"center\" class=\"style3\">" . $parse["temp"][0] . "</div></td>
<td><div align=\"center\" class=\"style3\">" . $parse["temp"][2] . "</div></td>
");
}
}
}
?>
</tr>
</table>
</body>
</html>

DEMO: http://www.de-cayed.co.uk/rs/

jacko2244
29-10-2009, 08:47 PM
I haven't got a clue with PHP!

But cool script :D

Swinkid
29-10-2009, 08:48 PM
Considering thats missing half its code, thanks. :P

Want to hide these adverts? Register an account for free!