Jump to content

rswildy

Members
  • Posts

    98
  • Joined

  • Last visited

Posts posted by rswildy

  1. that all works fine but when skill is found it will show link however if its not found(they aren't ranked), It wont show link. I want it to show link no matter what, How could i do that?EDIT: Oh haha it does, My bad it was an error i made.

  2. I understand that but i mean i don't want to change the output of ALL the skills, I wish to change them all so you can click the skill and it will take you to a link (diffrent for each one), Any ideas?

  3. Hi, Now if i change the name of the skill it won't work because its getting the source from runescape.com so if i wanted to make say the "Attack" go to a page called attack.php or wanted to change the font to red / bold or something how could that be done, If you altar the name on the $skill_list it wont work you will just get an extra tab onto the hiscore list. For example if you put <b> </b> tags on Overall then it will show up twice on the hiscore list the bold version will just say -- and wont retrieve any details the normal version will apear as normal (unedited).

    <?phpif (isset($_GET['name'])){  $skill_list = 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");  $contents = "";  $handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".urlencode($_GET['name']),"r");  if($handle)  {	while (!feof($handle))	{	  $contents .= fread($handle, 8192);	}	fclose($handle);  }  echo "<table cellpadding=\"0\" cellspacing=\"0\">";  echo "<tr>";  echo "<td style=\"border-bottom: 1px solid black;\">Skill</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Rank</td>";  echo "<td style=\"border-bottom: 1px solid black;\">Level</td>";  echo "<td style=\"border-bottom: 1px solid black;\">XP</td>";  echo "</tr>";  $bg = false;  $found_skills = array();  $skills = parse($contents);  foreach ($skills as $info)  {	if ($bg)	  echo "<tr style=\"background: #333333;\">";	else	  echo "<tr>";	echo "<td>{$info['skill']}</td>";	echo "<td>{$info['rank']}</td>";	echo "<td>{$info['level']}</td>";	echo "<td>{$info['xp']}</td>";	echo "</tr>";	$found_skills[] = $info['skill'];	$bg = !$bg;  }  $missing_skills = array_diff($skill_list, $found_skills);  foreach($missing_skills as $skill)  {	if ($bg)	  echo "<tr style=\"background: #333333;\">";	else	  echo "<tr>";	echo "<td>{$skill}</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "<td>--</td>";	echo "</tr>";	$bg = !$bg;  }  echo "</table>";}function parse($contents){  $matches = array();  $pattern = "@<tr>\\s<td.*><a.*>\\s([^<]+)\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $nr_matches = preg_match_all($pattern, $contents, $matches);  $retval = array();  $i = 0;  for ($i = 0; $i < count($matches[1]); $i++)  {	$retval[$i]['skill'] = $matches[1][$i];	$retval[$i]['rank'] = $matches[2][$i];	$retval[$i]['level'] = $matches[3][$i];	$retval[$i]['xp'] = $matches[4][$i];  }  return $retval;}?>

    Thanks, Rswildy.

  4. Hi.

    <?php$contents = "";$handle = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=". urlencode($_GET['username']),"r");if($handle){  while (!feof($handle))  {	$contents .= fread($handle, 8192);  }  fclose($handle);}function parse($skill_name){  global $contents;  $matches = array();  $pattern = "@<tr>\\s<td.*><img.*></td>\\s<td.*><a.*>\\s" . $skill_name . "\\s</a></td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s<td.*>([0-9,\\s]*)</td>\\s</tr>@imsU";  $match_found = preg_match($pattern, $contents, $matches);  $retval = array();  if ($match_found && $matches[1] != "")	$retval['rank'] = $matches[1];  else	$retval['rank'] = "--";  if ($match_found && $matches[2] != "")	$retval['level'] = $matches[2];  else	$retval['level'] = "--";  if ($match_found && $matches[3] != "")	$retval['xp'] = $matches[3];  else	$retval['xp'] = "--";  return $retval;}$target_lvl  = $_GET['target_lvl'] * 150 + $Woodcutting['xp'];$Woodcutting = parse("Woodcutting");echo "Rank: " . $Woodcutting['rank'] . "<br>";echo "Level: " . $Woodcutting['level'] . "<br>";echo "XP: " . $Woodcutting['xp'] . "<br>";echo "You need to cut " . $Woodcutting['level'] . " Yew trees. " . "<br />";echo "If you cut " . $_GET['target_lvl'] . " Yew trees you will have a total of " . $target_lvl. "xp." . "<br />";?>

    The output of this code is everything shows fine except:

    $target_lvl  = $_GET['target_lvl'] * 150 + $Woodcutting['xp'];

    The problem with this line is the + $woodcutting['xp'] i think its because the numbers on the main code ['xp'] are formatted with commas' If someone could make it work then i would be happy.Thanks, Rswildy.

  5. I don't think that can be done however you can make it so that you can see 1 table on left side then right side could be visible with extra table under but no border i think, Never really crossed my mind to try that. you can always try making 2 X 2 table then removing 1 of the tables from inside so its 2 on 1 side and 1 on the other.

    Border

    Try this:

    .picture {	background-image: url((URL));	height: 50px;	border: 1px solid #000000;	width: 50px;}

    Rswildy.

  6. Well I've only recently started learning PHP but yesterday i took about 5 hours writing a script, hah most people can do this in about 10 mins but it was hard getting all the correct details for the month year and calculating it all together ect. It's not very good but its my first one . I wanted to know if anything needs fixing here is the code.

    <form method="GET" action="trynumber.php"><fieldset><legend><u>To find out how old you are fill in the following fields</u></legend><p><label for="y_old">How many Years old are you</label><br /><input type="text" name="y_old" size="3" /><br /><label for="m_old">How many Months old are you</label><br /><input type="text" name="m_old" size="2" /><br /><label for="d_old">How many days old are you</label><br /><input type="text" name="d_old" size="2" /> (Optional, Leave empty if you don't know)<br /><br /><br /><input type="submit" name="calcgo" value="calculate" /> </p></fieldset></form><?phpif ($_GET['calcgo'] == 'calculate') {$day   = $_GET['d_old'];$month = $_GET['m_old'];$year  = $_GET['y_old'];$ans_month   = ($year * 365.242199 / 30.4368499 + $month);$ans_week	= ($year * 365.242199 + $month * 30.4368499 + $day);$ans_day	 = ($year * 365.242199 + $month * 30.4368499 + $day);$ans_hours   = ($year * 365.242199 + $month * 30.4368499 + $day);$ans_seconds = ($year * 365.242199 + $month * 30.4368499 + $day);echo "You are " . $year . " years old." . "<br />";echo "You are " . round($ans_month) . " months old." . "<br />";echo "You are " . round($ans_week / 7) . " weeks old." . "<br />";echo "You are " . round($ans_day) . " days old." . "<br />";echo "You are " . round($ans_hours * 24) . " hours old." . "<br />";echo "You are " . round($ans_seconds * 24 * 60 ) . " Seconds old. " . "<br />";}?>

    Please let me know what you think.Thanks, Rswildy.

  7. Try dreamweaver that makes things very simple, and there are lots of other editors out there that will make this sort of thing easy, to change your logo find this (Located in your CSS file).

    div#header {	color: #505623;	background: #e7ead1 url('identity.gif') no-repeat bottom right;	font-size: 1em;	font-family: Georgia, times, serif;	border-bottom: 2px solid #9fac46;}

    Change identity.gif to your new banner url.To make the corners round you will have to use images, sinse the page expands it won't be to easy.Hope this clears things up, Rswildy.

  8. Do you want a fixed height page or a page that will expand whenever you add new content :)You could try using tables - I onced used them to control my <div> tags.

    <table width="800" border="0">  <tr>	<td width="143" height="100%" align="left" valign="top">Navigation DIV tag </td>	<td width="441" height="100%" colspan="2" align="left" valign="top">Content DIV tag</td>  </tr>  <tr>	<td height="100%" colspan="3" align="center">Footer DIV tag </td>  </tr></table>

  9. Use CSS.

    #navigation {	float: left;	width: 250px;	height: 700px;}#content {	float: right;	width: 650px;	height:700px;}

    Use the height and change it to whatever size you want, I'm not sure i quite understood the question if thats not what you mean then sorry my bad.

×
×
  • Create New...