Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.49 KB | None | 0 0
  1. <?php
  2. if(!defined('INITIALIZED'))
  3.     exit;
  4.  
  5. $cache_sec = 1;
  6. $info = array(
  7.     0 => array($config['server']['location'], date("d/m/Y")),
  8.     1 => array('EUA', date("d/m/Y"))
  9. );
  10.  
  11. $id=0;
  12. if(isset($_POST['world'])) {
  13.     $f = null;
  14.     foreach($config['site']['worlds'] as $k => $v)
  15.         if($v == $_POST['world']) {
  16.             $f = true;
  17.             $id = $k;
  18.             break;
  19.         }
  20.     if(!$f)
  21.         $_POST['world'] = $config['site']['worlds'][0];
  22. } else $_POST['world'] = $config['site']['worlds'][0];
  23.  
  24. $order = 'name_asc';
  25. if(isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('name_desc', 'level_asc','level_desc','vocation_asc','vocation_desc')))
  26.     $order = $_REQUEST['order'];
  27.  
  28. if(count($config['site']['worlds']) > 1) {
  29.     $main_content ='
  30. <form action="?subtopic=whoisonline" method="post">
  31.     <div class="TableContainer">
  32.         <table class="Table1" cellpadding="0" cellspacing="0">
  33.             <div class="CaptionContainer">
  34.                 <div class="CaptionInnerContainer">
  35.                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  36.                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  37.                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  38.                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  39.                     <div class="Text">World Selection</div>
  40.                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  41.                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  42.                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  43.                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  44.                 </div>
  45.             </div>
  46.             <tr>
  47.                 <td>
  48.                     <div class="InnerTableContainer">
  49.                         <table width="100%">
  50.                             <tr>
  51.                                 <td style="vertical-align:middle" class="LabelV150">World Name:</td>
  52.                                 <td style="width:170px">
  53.                                     <select size="1" name="world" style="width:165px">';
  54. foreach($config['site']['worlds'] as $v)
  55.     $main_content .= '<option value="'.$v.'"'.($v == $_POST['world'] ? ' selected="selected"' : '').'>'.$v.'</option>';
  56. $main_content .= '
  57.                                     </select>
  58.                                 </td>
  59.                                 <td style="text-align:left">
  60.                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)">
  61.                                         <div onmouseover="MouseOverBigButton(this)" onmouseout="MouseOutBigButton(this)"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif)"></div>
  62.                                             <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif"/>
  63.                                         </div>
  64.                                     </div>
  65.                                 </td>
  66.                             </tr>
  67.                         </table>
  68.                     </div>
  69.                 </td>
  70.             </tr>
  71.         </table>
  72.     </div>
  73. </form><br/>
  74. ';
  75. }
  76. $main_content .=
  77. '<div class="TableContainer">
  78.     <table class="Table1" cellpadding="0" cellspacing="0">
  79.         <div class="CaptionContainer">
  80.             <div class="CaptionInnerContainer">
  81.                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  82.                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  83.                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  84.                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  85.                 <div class="Text">World Information</div>
  86.                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  87.                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  88.                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  89.                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  90.             </div>
  91.         </div>
  92.         <tr>
  93.             <td>
  94.                 <div class="InnerTableContainer">
  95.                     <table width="100%">
  96.                         <tr>
  97.                             <td class="LabelV150"><b>Status:</b></td>
  98.                             <td>O'.($config['status']['serverStatus_online'] == 1 ? 'n' : 'ff').'line</td>
  99.                         </tr>
  100.                         <tr>
  101.                             <td class="LabelV150"><b>Players Online:</b></td>
  102.                             <td>';
  103. $f = 'cache/whoisonline-'.$_POST['world'].'-'.$order.'.tmp';
  104. $ff = 'cache/whoisonline-'.$_POST['world'].'-record.tmp';
  105. if(file_exists($f) && filemtime($f) > (time() - $cache_sec)) {
  106.     $cp = file_get_contents($f);
  107.     $cached = null;
  108.     if(file_exists($f) && filemtime($f) > (time() - $cache_sec)) {
  109.         $e = explode('|', file_get_contents($ff));
  110.         $n = $e[0];
  111.         $c = $e[1];
  112.         $cached = true;
  113.     }
  114. }
  115. else {
  116.     $cp = '';
  117.     $n = 0;
  118.     $q = 'SELECT * FROM players WHERE world_id='.$id.' AND online=1';
  119.     if(in_array($order, array('name_asc','name_desc','level_asc','level_desc')))
  120.         $q .= ' ORDER BY '.str_replace('_', ' ', $order);
  121.  
  122.     if(in_array($order, array('vocation_asc','vocation_desc'))) {
  123.         $a = array();
  124.         foreach($SQL->query($q)->fetchAll() as $p)
  125.             $a[] = array($p['name'], $p['level'], $vocation_name[$id][$p['promotion']][$p['vocation']], array($p['looktype'], $p['lookaddons'], $p['lookhead'], $p['lookbody'], $p['looklegs'], $p['lookfeet']));
  126.         function cmp($a, $b) {
  127.             $r = strcmp($a[2], $b[2]);
  128.             $r = $GLOBALS['order'] == 'vocation_desc' ? ($r == 1 ? -1 : ($r == -1 ? 1 : 0)) : $r;
  129.             return ($r == 0 && $a[1] < $b[1]) ? 1 : $r;
  130.         }
  131.         usort($a, 'cmp');
  132.         foreach($a as $p) {
  133.             $n++;
  134.             $cp .= '<tr class="'.(is_int($n/2)?'Odd':'Even').'" style="text-align:right"><td><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(' . $config['site']['outfit_images_url'] . '?id='.$p[3][0].'&addons='.$p[3][1].'&head='.$p[3][2].'&body='.$p[3][3].'&legs='.$p[3][4].'&feet='.$p[3][5].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></td><td style="width:70%;text-align:left"><a href="?subtopic=characters&name='.urlencode($p[0]).'">'.$p[0].'</a></td><td style="width:10%">'.$p[1].'</td><td style="width:20%">'.str_replace(' ','&#160;',$p[2]).'</td></tr>';
  135.         }
  136.  
  137.     }
  138.     else {
  139.         $l = array();
  140.        
  141.         foreach($SQL->query($q)->fetchAll() as $p) {
  142.             $n++;
  143.             $cp .= '<tr class="'.(is_int($n/2)?'Odd':'Even').'" style="text-align:right">';
  144.             $cp .= '<td style="width:70%;text-align:left"><td><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\''.$outfit.'?id='.$p['looktype'].'&addons='.$p['lookaddons'].'&head='.$p['lookhead'].'&body='.$p['lookbody'].'&legs='.$p['looklegs'].'&feet='.$p['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></td>';
  145.             if($order == 'name_asc') {
  146.                 $tmp = strtoupper($p['name'][0]);
  147.                 if(!in_array($tmp, $l)) {
  148.                     $l[] = $tmp;
  149.                     $cp .= '<a name="'.$tmp.'"></a>';
  150.                 }
  151.             }
  152.             $cp .= '<a href="?subtopic=characters&name='.urlencode($p['name']).'">'.$p['name'].'</a></td><td style="width: 10%">'.$p['level'].'</td><td style="width:20%">'.str_replace(' ','&#160;',$vocation_name[$p['promotion']][$p['vocation']]).'</td></tr>';
  153.         }
  154.        
  155.     }
  156.     file_put_contents($f, $cp);
  157. }
  158. if(!$cached) {
  159.     $r=$SQL->query('SELECT MAX(record) as r,MAX(timestamp) as t FROM server_record WHERE world_id='.$id)->fetch();
  160.     $c = $r['r'].' players (on '.date('M&#160;d&#160;Y,&#160;H:i:s&#160;T', $r['t']).')';
  161.     file_put_contents($ff, $n.'|'.$c);
  162. }
  163. $main_content .= $n.' Players Online</td>
  164.                         </tr>
  165.                         <tr>
  166.                             <td class="LabelV150"><b>Online Record:</b></td>
  167.                             <td>'.$c.'</td>
  168.                         </tr>
  169.                         <tr>
  170.                             <td class="LabelV150"><b>Creation Date:</b></td>
  171.                             <td>'.$info[$id][1].'</td>
  172.                         </tr>
  173.                         <tr>
  174.                             <td class="LabelV150"><b>Location:</b></td>
  175.                             <td>'.$info[$id][0].'</td>
  176.                         </tr>
  177.                         <tr>
  178.                             <td class="LabelV150"><b>PvP Type:</b></td>
  179.                             <td>';
  180. $w=strtolower($config['server']['worldType']);
  181. if(in_array($w, array('pvp','2','normal','open','openpvp')))
  182.     $main_content .= 'Open PvP';
  183. elseif(in_array($w, array('no-pvp','nopvp','non-pvp','nonpvp','1','safe','optional','optionalpvp')))
  184.     $main_content .= 'Optional PvP';
  185. elseif(in_array($w, array('pvp-enforced','pvpenforced','pvp-enfo','pvpenfo','pvpe','enforced','enfo','3','war','hardcore','hardcorepvp')))
  186.     $main_content .= 'Hardcore PvP';
  187. $main_content .= '</td>
  188.                         </tr>
  189.                     </table>
  190.                 </div>
  191.             </td>
  192.         </tr>
  193.     </table>
  194. </div><br/>
  195.     <div class="TableContainer">
  196.         <table class="Table2" cellpadding="0" cellspacing="0">
  197.         <div class="CaptionContainer">
  198.         <div class="CaptionInnerContainer">
  199.         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  200.         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  201.         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  202.         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  203.         <div class="Text">Players Online';
  204. if($order == 'name_asc')
  205.     $main_content .= '<span class="TableHeadlineNavigation"> [
  206.     <a href="#A">A</a>
  207.     <a href="#B">B</a>
  208.     <a href="#C">C</a>
  209.     <a href="#D">D</a>
  210.     <a href="#E">E</a>
  211.     <a href="#F">F</a>
  212.     <a href="#G">G</a>
  213.     <a href="#H">H</a>
  214.     <a href="#I">I</a>
  215.     <a href="#J">J</a>
  216.     <a href="#K">K</a>
  217.     <a href="#L">L</a>
  218.     <a href="#M">M</a>
  219.     <a href="#N">N</a>
  220.     <a href="#O">O</a>
  221.     <a href="#P">P</a>
  222.     <a href="#Q">Q</a>
  223.     <a href="#R">R</a>
  224.     <a href="#S">S</a>
  225.     <a href="#T">T</a>
  226.     <a href="#U">U</a>
  227.     <a href="#V">V</a>
  228.     <a href="#W">W</a>
  229.     <a href="#X">X</a>
  230.     <a href="#Y">Y</a>
  231.     <a href="#Z">Z</a> ]&#160;&#160;</span>';
  232. $main_content .= '</div>
  233. <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>
  234. <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>
  235. <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  236. <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>
  237. </div>
  238. </div>
  239. <tr>
  240. <td>
  241. <div class="InnerTableContainer">
  242. <table width="100%">
  243. <tr class="LabelH">
  244. <td style="text-align:center;width:5%">Outfit&#160;&#160;</td>
  245. <td style="text-align:left;width:50%">Name&#160;&#160;<small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=name_'.($order == 'name_asc' ? 'desc' : 'asc').'">sort</a>]</small>
  246. <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'name_asc' ? 'content/order_desc' : ($order == 'name_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td>
  247. <td style="text-align:left;width:30%">Level&#160;&#160;
  248. <small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=level_'.($order == 'level_asc' ? 'desc' : 'asc').'">sort</a>]</small>
  249. <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'level_asc' ? 'content/order_desc' : ($order == 'level_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td>
  250. <td style="text-align:left;width:50%">Vocation&#160;&#160;<small style="font-weight:normal">[<a href="?subtopic=whoisonline&world='.$_POST['world'].'&order=vocation_'.($order == 'vocation_asc' ? 'desc' : 'asc').'">sort</a>]</small>
  251. <img class="sortarrow" src="'.$layout_name.'/images/'.($order == 'vocation_asc' ? 'content/order_desc' : ($order == 'vocation_desc' ? 'content/order_asc' : 'news/blank')).'.gif"/></td>
  252. </tr>';
  253.  
  254. $main_content .= $cp;
  255. if (!$cp){$main_content .='<tr><td colspan="3" align="center"><i>This server no has players online.</i></td></tr>';}
  256. $main_content .='
  257. </table>
  258. </div>
  259. </table>
  260. </div>
  261. </td>
  262. </tr>
  263. <br/>
  264. <form action="?subtopic=characters" method="post"><div class="TableContainer">  <table class="Table1" cellpadding="0" cellspacing="0">    <div class="CaptionContainer">      <div class="CaptionInnerContainer">        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <div class="Text">Search Character</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif)"></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/content/table-headline-border.gif)"></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif)"></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer">          <table width="100%"><tr><td style="vertical-align:middle" class="LabelV150"><b>Character Name:</b></td><td style="width:170px"><input style="width:165px" name="name" value="" size="29" maxlength="29"/></td><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)"><div onmouseover="MouseOverBigButton(this)" onmouseout="MouseOutBigButton(this)"><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif)"></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif"></div></div></td></tr>          </table>        </div>  </table></div></td></tr></form></center>';
  265. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement