Advertisement
Guest User

highscores.php

a guest
Aug 22nd, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.10 KB | None | 0 0
  1. <?PHP
  2. $list = $_REQUEST['list'];
  3. $page = $_REQUEST['page'];
  4. $storage = "12345"; // storage key
  5.  
  6. switch($list)
  7. {
  8.   case "fist":
  9.    $id = 0;
  10.    $list_name = 'Fist Fighting';
  11.    break;
  12.   case "club":
  13.    $id = 1;
  14.    $list_name = 'Club Fighting';
  15.    break;
  16.   case "sword":
  17.    $id = 2;
  18.    $list_name = 'Sword Fighting';
  19.    break;
  20.   case "axe":
  21.    $id = 3;
  22.    $list_name = 'Axe Fighting';
  23.    break;
  24.   case "distance":
  25.    $id = 4;
  26.    $list_name = 'Distance Fighting';
  27.    break;
  28.   case "shield":
  29.    $id = 5;
  30.    $list_name = 'Shielding';
  31.    break;
  32.   case "fishing":
  33.    $id = 6;
  34.    $list_name = 'Fishing';
  35.    break;
  36. }
  37. if(!isset($id))
  38.     if($list == "magic")
  39.         $list_name = "Magic Level";
  40.     elseif($list == "rebirths")
  41.         $list_name = "rebirths";
  42.     else
  43.     {
  44.         $list_name = 'Experience';
  45.         $list = 'experience';
  46.     }
  47. if(count($config['site']['worlds']) > 1)
  48. {
  49.     $worlds .= '<i>Select world:</i> ';
  50.     foreach($config['site']['worlds'] as $idd => $world_n)
  51.     {
  52.         if($idd == (int) $_GET['world'])
  53.         {
  54.             $world_id = $idd;
  55.             $world_name = $world_n;
  56.         }
  57.     }
  58. }
  59.         if($idd == (int) $_GET['world'])
  60.         {
  61.             $world_id = $idd;
  62.             $world_name = $world_n;
  63.         }
  64. if(!isset($world_id))
  65. {
  66.     $world_id = 0;
  67.     $world_name = $config['server']['serverName'];
  68. }
  69. $offset = $page * 100;
  70. if(isset($id))
  71.     $skills = $SQL->query('SELECT accounts.flag as flag, players.name,players.online,player_skills.value,players.level,players.vocation,players.promotion FROM player_skills LEFT JOIN `players` ON `player_skills`.`player_id`=`players`.`id` LEFT JOIN `accounts` ON `accounts`.`id` = `players`.`account_id` WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.id = player_skills.player_id AND player_skills.skillid = '.$id.' ORDER BY player_skills.value DESC, player_skills.count DESC LIMIT 101 OFFSET '.$offset);
  72. elseif($list == "magic")
  73.     $skills = $SQL->query('SELECT accounts.flag as flag, players.name,players.online,players.maglevel,players.level,players.vocation,players.promotion FROM players LEFT JOIN `accounts` ON `accounts`.`id` = `players`.`account_id`  WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.name != "Account Manager" ORDER BY players.maglevel DESC, players.manaspent DESC LIMIT 101 OFFSET '.$offset);
  74. elseif($list == "rebirths")
  75.     $skills = $SQL->query('SELECT `accounts`.`flag` as flag, `players`.`name`, `players`.`level`, `players`.`vocation`, `players`.`promotion`, `player_storage`.`value` as rebirths FROM `players` LEFT JOIN `accounts` ON `accounts`.`id` = `players`.`account_id` LEFT JOIN `player_storage` ON `player_storage`.`player_id` = `players`.`id` WHERE `player_storage`.`key` = '.$storage.' AND `players`.`world_id` = '.$world_id.' AND `players`.`deleted` = 0 AND `players`.`group_id` < '.$config['site']['players_group_id_block'].' AND `players`.`account_id` != 1 ORDER BY `player_storage`.`value` DESC, `players`.`name` ASC LIMIT 101 OFFSET '.$offset);
  76. elseif($list == "experience")
  77.     $skills = $SQL->query('SELECT accounts.flag as flag, players.name,players.online,players.level,players.experience,players.vocation,players.promotion FROM players LEFT JOIN `accounts` ON `accounts`.`id` = `players`.`account_id`  WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.name != "Account Manager" ORDER BY players.level DESC, players.experience DESC LIMIT 101 OFFSET '.$offset);
  78.  
  79. //wyswietlanie wszystkiego
  80. $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><CENTER><H2>Ranking for '.$list_name.' on '.$world_name.'</H2></CENTER><BR>';
  81.     $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD></TD><TD>
  82. <FORM ACTION="?subtopic=highscores" METHOD=get><INPUT TYPE=hidden NAME=subtopic VALUE=highscores><INPUT TYPE=hidden NAME=list VALUE=experience>
  83. <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>World Selection</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['lightborder'].'">
  84.    <TABLE BORDER=0 CELLPADDING=1><TR><TD>World: </TD><TD><SELECT SIZE="1" NAME="world"><OPTION VALUE="" SELECTED>(choose world)</OPTION>';
  85.     foreach($config['site']['worlds'] as $id => $world_n)
  86. {
  87.     $main_content .= '<OPTION VALUE="'.$id.'">'.$world_n.'</OPTION>';
  88. }
  89.     $main_content .= '</SELECT> </TD><TD><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
  90.        </TD></TR></TABLE></TABLE></FORM></TABLE><br><br><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=75% CLASS=whites><B>Name</B></TD><TD WIDTH=15% CLASS=whites><b><center>Level</center></B></TD>';
  91. if($list == "experience")
  92.     $main_content .= '<TD CLASS=whites><b><center>Points</center></B></TD>';
  93. $main_content .= '</TR><TR>';
  94. foreach($skills as $skill)
  95. {
  96.     $flag = '';
  97.         if(!empty($skill['flag']))
  98.         $flag = '<img src = "http://images.boardhost.com/flags/'.$skill['flag'].'.png" />';
  99.     if($number_of_rows < 100)
  100.     {
  101.         if($list == "magic")
  102.             $skill['value'] = $skill['maglevel'];
  103.         if($list == "rebirths")
  104.             $skill['value'] = $skill['rebirths'];
  105.         if($list == "experience")
  106.             $skill['value'] = $skill['level'];
  107.         if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  108.         $main_content .= '<tr bgcolor="'.$bgcolor.'"><td>'.($offset + $number_of_rows).'.</td><td>'.$flag.' <a href="index.php?subtopic=characters&name='.urlencode($skill['name']).'">'.$skill['name'].'</a><br><small>'.$skill['level'].' '.$vocation_name[$world_id][$skill['promotion']][$skill['vocation']].'</small></td><td><center>'.$skill['value'].'</center></td>  ';
  109.         if($list == "experience")
  110.             $main_content .= '<td><center>'.$skill['experience'].'</center></td>';
  111.         $main_content .= '</tr>';
  112.     }
  113.     else
  114.         $show_link_to_next_page = TRUE;
  115. }
  116. $main_content .= '</TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>';
  117. if($page > 0)
  118.     $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($page - 1).'" CLASS="size_xxs">Previous Page</A></TD></TR>';
  119. if($show_link_to_next_page)
  120.     $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($page + 1).'" CLASS="size_xxs">Next Page</A></TD></TR>';
  121. $main_content .= '</TABLE></TD><TD WIDTH=5%><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD><TD WIDTH=15% VALIGN=top ALIGN=right><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=whites><B>Choose a skill</B></TD></TR><TR BGCOLOR="'.$config['site']['lightborder'].'"><TD><A HREF="?subtopic=highscores&list=experience&world='.$world_id.'" CLASS="size_xs">Experience</A><BR><A HREF="?subtopic=highscores&list=magic&world='.$world_id.'" CLASS="size_xs">Magic</A><BR><A HREF="?subtopic=highscores&list=rebirths&world='.$world_id.'" CLASS="size_xs">Rebirths</A><BR><A HREF="?subtopic=highscores&list=shield&world='.$world_id.'" CLASS="size_xs">Shielding</A><BR><A HREF="?subtopic=highscores&list=distance&world='.$world_id.'" CLASS="size_xs">Distance</A><BR><A HREF="?subtopic=highscores&list=club&world='.$world_id.'" CLASS="size_xs">Club</A><BR><A HREF="?subtopic=highscores&list=sword&world='.$world_id.'" CLASS="size_xs">Sword</A><BR><A HREF="?subtopic=highscores&list=axe&world='.$world_id.'" CLASS="size_xs">Axe</A><BR><A HREF="?subtopic=highscores&list=fist&world='.$world_id.'" CLASS="size_xs">Fist</A><BR><A HREF="?subtopic=highscores&list=fishing&world='.$world_id.'" CLASS="size_xs">Fishing</A><BR></TD></TR></TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
  122.  
  123. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement