• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Highscores table bugged

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hello, I'm editing my highscores, but I'm having so much problems with that. Hope someone can help me with that because it's really pissing me off.

Getting a problem with numeration isn't right.

inb4: gesior

Check the image below
hrjmlnc0m.png


And the code
Code:
<?php
if(!defined('INITIALIZED'))
   exit;

$list = 'level';
if(isset($_REQUEST['list']))
   $list = $_REQUEST['list'];

$page = 0;
if(isset($_REQUEST['page']))
   $page = min(50, $_REQUEST['page']);

$vocation = '';
if(isset($_REQUEST['vocation']))
   $vocation = $_REQUEST['vocation'];

switch($list)
{
   case "fist":
     $id=Highscores::SKILL_FIST;
     $list_name='Fist Fighting';
     break;
   case "club":
     $id=Highscores::SKILL_CLUB;
     $list_name='Club Fighting';
     break;
   case "sword":
     $id=Highscores::SKILL_SWORD;
     $list_name='Sword Fighting';
     break;
   case "axe":
     $id=Highscores::SKILL_AXE;
     $list_name='Axe Fighting';
     break;
   case "distance":
     $id=Highscores::SKILL_DISTANCE;
     $list_name='Distance Fighting';
     break;
   case "shield":
     $id=Highscores::SKILL_SHIELD;
     $list_name='Shielding';
     break;
   case "fishing":
     $id=Highscores::SKILL_FISHING;
     $list_name='Fishing';
     break;
   case "magic":
     $id=Highscores::SKILL__MAGLEVEL;
     $list_name='Magic';
     break;
   default:
     $id=Highscores::SKILL__LEVEL;
     $list_name='Experience';
     break;
}
$world_name = $config['server']['serverName'];

$offset = $page * 50;
$skills = new Highscores($id, 50, $page, $vocation);
$main_content .= '
       <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD></TD><TD><H3>Ranking for '.htmlspecialchars($list_name).'</H3>';
           $main_content .= '<br>
           <div class="row-fluid" style="clear: both">
             <div class="span3">
               <ul class="nav nav-pills nav-stacked">                       
                 <li>
                   <a href="ranking&list=level">Level</a>
                 </li>                       
                 <li>
                   <a href="ranking&list=magic">Magic Level</a>
                 </li>                       
                 <li>
                   <a href="ranking&list=fishing">Fishing</a>
                 </li>
                 <li>
                   <a href="ranking&list=shield">Shielding</a>
                 </li>                       
                 <li>
                   <a href="ranking&list=distance">Distance Fighting</a>
                 </li>
                 <li>
                   <a href="ranking&list=axe">Axe Fighting</a>
                 </li>   
                 <li>
                   <a href="/ranking&list=sword">Sword Fighting</a>
                 </li>
                 <li>
                   <a href="ranking&list=club">Club Fighting</a>
                 </li>
                   <li><a href="ranking&list=fist">Fist Fighting</a>
                 </li>                   
               </ul>
             </div>
             <div class="span9">
               <table class="table table-striped table-condensed">
                 <thead>               
                   <TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE>
                   <TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
                     <TR>
                       <TD CLASS=whites><B>#</B></TD>
                       <TD WIDTH=75% CLASS=whites><B>Name</B></TD>
                       <TD WIDTH=15% CLASS=whites><b><center>Level</center></B></TD>
                     </thead>
                     </TD>';
   if($list == "level")
     $main_content .= '<TD CLASS=whites><b><center>Experience</center></B>';
   $number_of_rows = 0;
   foreach($skills as $skill)
   {
     if($list == "magic")
       $value = $skill->getMagLevel();
     elseif($list == "level")
       $value = $skill->getLevel();
     else
       $value = $skill->getScore();
     
     $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['auradark'] : $config['site']['auralight']);
     $main_content .= '
       <tr style="border-top: #DDDDDD 1px solid;" bgcolor="'.$bgcolor.'">
         <td style="text-align:right">'.($offset + $number_of_rows).'.</td>
           <td>
             <a href="?subtopic=characters&name='.urlencode($skill->getName()).'">'.($skill->getOnline()>0 ? "
               <font color=\"green\">".htmlspecialchars($skill->getName())."</font>" : "<font color=\"red\">".htmlspecialchars($skill->getName())."</font>").'
             </a>
             <br>
               <small>
                 '.$skill->getLevel().' '.htmlspecialchars(Website::getVocationName($skill->getVocation())).'
               </small>
           </td>
           <td>
             <center>'.$value.'</center>
           </td>';
     if($list == "level")
       $main_content .= '<td><center>'.$skill->getExperience().'</center></td></tr></tr>';
   }
     $main_content .= '</TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>';
     if($page > 0)
       $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="ranking&list='.urlencode($list).'&page='.($page - 1).'&vocation=' . urlencode($vocation) . '" CLASS="size_xxs">Previous Page</A></TD></TR>';
     if($page < 50)
       $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="ranking&list='.urlencode($list).'&page='.($page + 1).'&vocation=' . urlencode($vocation) . '" CLASS="size_xxs">Next Page</A></TD></TR>';
     $main_content .= '<tbody>
         </div>
       </div>
     </table>
   </table>';
 
Last edited:
Back
Top