Advertisement
margoh

characterprofile.php

Oct 29th, 2013
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.89 KB | None | 0 0
  1. <?php require_once 'engine/init.php'; include 'layout/overall/header.php';
  2. if ($config['log_ip']) {
  3.     znote_visitor_insert_detailed_data(4);
  4. }
  5. if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
  6.     $name = $_GET['name'];
  7.    
  8.     if (user_character_exist($name)) {
  9.         $user_id = user_character_id($name);
  10.         if ($config['TFSVersion'] == 'TFS_10') {
  11.             $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin');
  12.             $profile_data['online'] = user_is_online_10($user_id);
  13.         } else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'online');
  14.         $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
  15.        
  16.         $guild_exist = false;
  17.         if (get_character_guild_rank($user_id) > 0) {
  18.             $guild_exist = true;
  19.             $guild = get_player_guild_data($user_id);
  20.             $guild_name = get_guild_name($guild['guild_id']);
  21.         }
  22.         ?>
  23.        
  24.         <!-- PROFILE MARKUP HERE-->
  25.         <h1>Character Profile:</h1>
  26.             <?php ?>
  27.             <table>
  28.             <tr class="yellow"><th><center>Name:</th><th><?php echo $profile_data['name']; ?></center></th></tr>
  29.             <tr><td>Level:</td><td><?php echo $profile_data['level']; ?></td></tr>
  30.             <tr><td>Vocation:</td><td><?php echo vocation_id_to_name($profile_data['vocation']); ?></td></tr>
  31.             <tr><td>Guild:</td><td><?php
  32.                 if ($guild_exist) {
  33.                 ?>
  34.                 <?php echo $guild['rank_name']; ?> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name; ?></a>
  35.                 <?php
  36.                 }
  37.                 else {
  38.                 echo 'None';
  39.                 }
  40.                 ?></td><tr>
  41.             <tr><td>Last Login:</td><td><?php if ($profile_data['lastlogin'] != 0) { echo getClock($profile_data['lastlogin'], true, false); } else { echo 'Never.'; }?></td></tr>
  42.             <tr><td>Status:</td><td><?php
  43.                         if ($config['TFSVersion'] == 'TFS_10') {
  44.                             if ($profile_data['online']) {
  45.                                 echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
  46.                             } else {
  47.                                 echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
  48.                             }
  49.                         } else {
  50.                             if ($profile_data['online'] == 1) {
  51.                                 echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
  52.                             } else {
  53.                                 echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
  54.                             }
  55.                         }
  56.                     ?></li></td></tr>
  57.             <tr><td>Created:</td><td><?php echo getClock($profile_znote_data['created'], true); ?></td></tr>
  58.             </table>
  59.                 <table><tr class="yellow">
  60.                 <th><center>Comment:</center>
  61.                 </th>
  62.                 </tr>
  63.                 <tr><td><center><textarea name="profile_comment_textarea" cols="70" rows="10" readonly="readonly" class="span12"><?php echo $profile_znote_data['comment']; ?></textarea></center></td></tr></table>
  64.                 <!-- DEATH LIST -->
  65.                 <li>
  66.                     <h1>Death List:</h1><br>
  67.                     <table id="characterprofileTable" class="table table-striped table-hover">
  68.                                 <tr class="yellow">
  69.                                     <th>
  70.                                         Date:
  71.                                     </th>
  72.                                     <th>
  73.                                         Level:
  74.                                     </th>
  75.                                     <th>
  76.                                         Killed by:
  77.                                     </th>
  78.                                 </tr>
  79.                     <?php
  80.                     if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
  81.                         $array = user_fetch_deathlist($user_id);
  82.                         if ($array) {
  83.                             //data_dump($array, false, "Data:");
  84.                             ?>
  85.                             <ul>
  86.                                 <?php
  87.                                 // Design and present the list
  88.                                 foreach ($array as $value) {
  89.                                     echo '<tr>';
  90.                                     // $value[0]
  91.                                     $value['time'] = getClock($value['time'], true);                   
  92.                                     if ($value['is_player'] == 1) {
  93.                                         $value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
  94.                                     } else {
  95.                                         $value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
  96.                                     }
  97.                                    
  98.                                     echo '<td>'. $value['time'] .'</td>
  99.                                     <td> Killed at level '. $value['level'] .'</td>
  100.                                     <td>'. $value['killed_by'];'</td>
  101.                                     </tr>';
  102.                                 }
  103.                             ?>
  104.                             </ul>
  105.                             <?php
  106.                             } else {
  107.                                 echo '<b><font color="green">This player has never died.</font></b>';
  108.                             }
  109.                             //Done.
  110.                         } else if ($config['TFSVersion'] == 'TFS_03') {
  111.                             $array = user_fetch_deathlist03($user_id);
  112.                             if ($array) {
  113.                             ?>
  114.                             <ul>
  115.                                 <?php
  116.                                 // Design and present the list
  117.                                 foreach ($array as $value) {
  118.                                     echo '<tr>';
  119.                                     $value[3] = user_get_killer_id(user_get_kid($value['id']));
  120.                                     if ($value[3] !== false && $value[3] >= 1) {
  121.                                         $namedata = user_character_data((int)$value[3], 'name');
  122.                                         if ($namedata !== false) {
  123.                                             $value[3] = $namedata['name'];
  124.                                             $value[3] = '<a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
  125.                                         } else {
  126.                                             $value[3] = 'deleted player.';
  127.                                         }
  128.                                     } else {
  129.                                         $value[3] = user_get_killer_m_name(user_get_kid($value['id']));
  130.                                         if ($value[3] === false) $value[3] = 'deleted player.';
  131.                                     }
  132.                                     echo '<td>'. getClock($value['date'], true) .'</td> <td>Killed at level '. $value['level'] .'.</td> <td>'. $value[3];
  133.                                     '</td></tr>';
  134.                                 }
  135.                             ?>
  136.                             </ul>
  137.                             <?php
  138.                             } else {
  139.                                 echo '<b><font color="green">This player has never died.</font></b>';
  140.                             }
  141.                         }
  142.                         ?>
  143.                 </table>
  144.                
  145.                 <!-- END DEATH LIST -->
  146.                
  147.                 <!-- CHARACTER LIST -->
  148.                 <?php
  149.                 if (user_character_hide($profile_data['name']) != 1 && user_character_list_count(user_character_account_id($name)) > 1) {
  150.                 ?>
  151.                     <li>
  152.                         <h1>Other visible characters on this account:</h1><br>
  153.                         <?php
  154.                         $characters = user_character_list(user_character_account_id($profile_data['name']));
  155.                         // characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
  156.                         if ($characters && count($characters) > 1) {
  157.                             ?>
  158.                             <table id="characterprofileTable" class="table table-striped table-hover">
  159.                                 <tr class="yellow">
  160.                                     <th>
  161.                                         Name:
  162.                                     </th>
  163.                                     <th>
  164.                                         Level:
  165.                                     </th>
  166.                                     <th>
  167.                                         Vocation:
  168.                                     </th>
  169.                                     <th>
  170.                                         Last login:
  171.                                     </th>
  172.                                     <th>
  173.                                         Status:
  174.                                     </th>
  175.                                 </tr>
  176.                                 <?php
  177.                                 // Design and present the list
  178.                                 foreach ($characters as $char) {
  179.                                     if ($char['name'] != $profile_data['name']) {
  180.                                         if (hide_char_to_name(user_character_hide($char['name'])) != 'hidden') {
  181.                                             echo '<tr>';
  182.                                             echo '<td><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
  183.                                             echo '<td>'. $char['level'] .'</td>';
  184.                                             echo '<td>'. $char['vocation'] .'</td>';
  185.                                             echo '<td>'. $char['lastlogin'] .'</td>';
  186.                                             echo '<td>'. $char['online'] .'</td>';
  187.                                             echo '</tr>';
  188.                                         }
  189.                                     }
  190.                                 }
  191.                             ?>
  192.                             </table>
  193.                             <?php
  194.                             } else {
  195.                                 echo '<b><font color="green">This player has never died.</font></b>';
  196.                             }
  197.                                 //Done.
  198.                             ?>
  199.                     </li>
  200.                 <?php
  201.                 }
  202.                 ?>
  203.                 <!-- END CHARACTER LIST -->
  204.                 <li><font class="profile_font" name="profile_font_share_url">Address: <a href="<?php
  205.                     if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
  206.                     else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
  207.                    
  208.                 ?>"><?php
  209.                     if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
  210.                     else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
  211.                 ?></a></font></li>
  212.             </ul>
  213.         <!-- END PROFILE MARKUP HERE-->
  214.        
  215.         <?php
  216.     } else {
  217.         echo htmlentities(strip_tags($name, ENT_QUOTES)).' does not exist.';
  218.     }
  219. } else {
  220.     header('Location: index.php');
  221. }
  222.  
  223. include 'layout/overall/footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement