JoseluisGGR

php

Sep 28th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.     Copyright (C) 2007 - 2008  Nicaw
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License along
  16.     with this program; if not, write to the Free Software Foundation, Inc.,
  17.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. */
  19. include ("include.inc.php");
  20. $ptitle="Characters - $cfg[server_name]";
  21. include("header.inc.php");
  22. ?>
  23. <div id="content">
  24. <div class="top">Character Lookup</div>
  25. <div class="mid">
  26. <form method="get" action="characters.php">
  27. <input type="text" name="player_name"/>
  28. <input type="submit" value="Search"/>
  29. </form>
  30. <?php
  31. $player = new Player();
  32. if (!empty($_GET['player_id']) && $player->load($_GET['player_id']) || !empty($_GET['player_name']) && $player->find($_GET['player_name'])){
  33.     echo '<hr/><table style="width: 100%"><tr><td><b>Name:</b> '.htmlspecialchars($player->getAttr('name'))."";
  34.    
  35.     if ($player->getAttr('premend') > 0){
  36.         echo "<b>(VIP)</b><br/>\n";
  37.     }
  38.  
  39.     echo '<b>Level:</b> '.$player->getAttr('level')."<br/>\n";
  40.     echo '<b>Magic Level:</b> '.$player->getAttr('maglevel')."<br/>\n";
  41.     echo '<b>Vocation:</b> '.$cfg['vocations'][$player->getAttr('vocation')]['name']."<br/>\n";
  42.  
  43.     if ($player->isAttr('guild_name')){
  44.         echo '<b>Guild:</b> '.$player->getAttr('guild_rank').' of <a href="guilds.php?guild_id='.$player->getAttr('guild_id').'">'.htmlspecialchars($player->getAttr('guild_name')).'</a><br/>'."\n";
  45.     }
  46.    
  47.     $gender = Array('Female','Male');
  48.     echo '<b>Gender:</b> '.$gender[$player->getAttr('sex')].'<br/>'."\n";
  49.     if (!empty($cfg['temple'][$player->getAttr('city')]['name']))
  50.         echo "<b>Residence</b>: ".ucfirst($cfg['temple'][$player->getAttr('city')]['name'])."<br/>";
  51.  
  52.     if ($player->isAttr('position')){
  53.         echo "<b>Position: </b> ".$player->getAttr('position')."<br/>";
  54.     }
  55.     if ($player->getAttr('premend') > 0){
  56.         echo "<b>Premium: </b> ".ceil((time() - $player->getAttr('premend'))/(3600*24))." day(s)";
  57.     }
  58.     if ($player->getAttr('lastlogin') == 0)
  59.         $lastlogin = 'Never';
  60.     else
  61.         $lastlogin = date("jS F Y H:i:s",$player->getAttr('lastlogin'));
  62.     echo "<b>Last Login:</b> ".$lastlogin."<br/>\n";
  63.     if ($player->getAttr('redskulltime') > time()) echo '<b>Frag time left:</b> '.ceil(($player->getAttr('redskulltime') - time())/60/60).' h</b><br/>';
  64.     if ($cfg['show_skills']){
  65.         echo "</td><td>";
  66.         $sn = $cfg['skill_names'];
  67.         for ($i=0; $i < count($sn); $i++){
  68.             echo '<b>'.ucfirst($sn[$i]).':</b> '.$player->getSkill($i)."<br/>\n";
  69.         }
  70.         echo '</td></tr>';
  71.     }
  72.     echo '</table>';
  73.     $account = new Account();
  74.     if ($account->load($player->getAttr('account')))
  75.         if (strlen($account->getAttr('comment'))>0){
  76.             echo "<b>Comments</b><br/><div style=\"overflow:hidden\"><pre>".htmlspecialchars($account->getAttr('comment'))."</pre></div><br/>\n";
  77.         }  
  78.     echo '<hr/>';
  79.     if ($cfg['show_deathlist']){
  80.         $deaths = $player->getDeaths();
  81.         if ($deaths !== false && !empty($deaths)){
  82.         echo '<b>Deaths</b><br/>';
  83.             foreach ($deaths as $death){
  84.                 $killer = new Player($death['killer']);
  85.                 if ($killer->exists())
  86.                     $name = '<a href="characters.php?char='.$death['killer'].'">'.$death['killer'].'</a>';
  87.                 else
  88.                     $name = $death['killer'];
  89.                 echo '<i>'.date("jS F Y H:i:s",$death['date']).'</i> Killed at level '.$death['level'].' by '.$name.'<br/>';
  90.             }
  91.         }
  92.     }
  93. }elseif (isset($_GET['player_id']) || isset($_GET['player_name'])) echo 'Player not found';
  94. ?>
  95. </div>
  96. <div class="bot"></div>
  97. </div>
  98. <?php include ("footer.inc.php");?>
Advertisement
Add Comment
Please, Sign In to add comment