Advertisement
Guest User

whoisonline

a guest
Sep 6th, 2012
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.16 KB | None | 0 0
  1. <?PHP
  2. $order = $_REQUEST['order'];
  3. if($order == 'name') {
  4. $orderby = 'name';
  5. }
  6. if($order == 'level') {
  7. $orderby = 'level';
  8. }
  9. if($order == 'vocation') {
  10. $orderby = 'vocation';
  11. }
  12. if(empty($orderby)) {
  13. $orderby = 'name';
  14. }
  15. if(count($config['site']['worlds']) > 1)
  16. {
  17. $worlds .= '<i>Select world:</i> ';
  18. foreach($config['site']['worlds'] as $idd => $world_n)
  19. {
  20. if($idd == (int) $_GET['world'])
  21. {
  22. $world_id = $idd;
  23. $world_name = $world_n;
  24. }
  25. }
  26. }
  27. if($idd == (int) $_GET['world'])
  28. {
  29. $world_id = $idd;
  30. $world_name = $world_n;
  31. }
  32. if(!isset($world_id))
  33. {
  34. $world_id = 0;
  35. $world_name = $config['server']['serverName'];
  36. }
  37. if(count($config['site']['worlds']) > 1)
  38. {
  39. $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD>
  40. <FORM ACTION="?subtopic=whoisonline" METHOD=get><INPUT TYPE=hidden NAME=subtopic VALUE=whoisonline><INPUT TYPE=hidden NAME=list VALUE=experience>
  41. <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'].'">
  42. <TABLE BORDER=0 CELLPADDING=1><TR><TD>World: </TD><TD><SELECT SIZE="1" NAME="world"><OPTION VALUE="" SELECTED>(choose world)</OPTION>';
  43. foreach($config['site']['worlds'] as $id => $world_n)
  44. {
  45. $main_content .= '<OPTION VALUE="'.$id.'">'.$world_n.'</OPTION>';
  46. }
  47. $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>
  48. </TD></TR></TABLE></TABLE></FORM></TABLE><br>';
  49. }
  50. $players_online_data = $SQL->query('SELECT * FROM players WHERE online > 0 AND world_id = '.$world_id.' ORDER BY '.$orderby);
  51. $number_of_players_online = 0;
  52. foreach($players_online_data as $player)
  53. {
  54. $number_of_players_online++;
  55. if($config['site']['show_flag'])
  56. {
  57. $account = $SQL->query('SELECT * FROM accounts WHERE id = '.$player['account_id'].'')->fetch();
  58. $flag = '<image src="http://images.boardhost.com/flags/'.$account['flag'].'.png"/> ';
  59. }
  60. if(is_int($number_of_players_online / 2))
  61. {
  62. $bgcolor = $config['site']['darkborder'];
  63. }
  64. else
  65. {
  66. $bgcolor = $config['site']['lightborder'];
  67. }
  68. $players_rows .= '
  69. <TR BGCOLOR='.$bgcolor.'>
  70. <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'outfitter.php?id='.$player['looktype'].'&addons='.$player['lookaddons'].'&head='.$player['lookhead'].'&body='.$player['lookbody'].'&legs='.$player['looklegs'].'&feet='.$player['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
  71. <TD WIDTH=70%>'.$flag.'<A HREF="index.php?subtopic=characters&name='.urlencode($player['name']).'">'.$player['name'].'</A></TD>
  72. <TD WIDTH=10%>'.$player['level'].'</TD>
  73. <TD WIDTH=20%>'.$vocation_name[$player['world_id']][$player['promotion']][$player['vocation']].'</TD>
  74. </TR>';
  75. }
  76. if($number_of_players_online == 0)
  77. {
  78. //server status - server empty
  79. $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Server Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>Currently no one is playing on '.$config['server']['serverName'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
  80. }
  81. else
  82. {
  83. //server status - someone is online
  84. $main_content .= '
  85. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
  86. <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
  87. <TD CLASS=white><B>Server Status</B></TD>
  88. </TR>
  89. <TR BGCOLOR='.$config['site']['darkborder'].'>
  90. <TD>';
  91. if($number_of_players_online == $config['status']['serverStatus_players'])
  92. $main_content .= 'Currently there are '.$number_of_players_online.' players is active';
  93. else
  94. $main_content .= 'Currently there are '.$config['status']['serverStatus_players'].' active and '.($number_of_players_online - $config['status']['serverStatus_players']).' AFK players';
  95. $main_content .= ' on '.$world_name.' gameworlds.<br>
  96. </TD>
  97. </TR>
  98. </TABLE><BR>';
  99. //list of players
  100. $main_content .= '
  101. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
  102. <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
  103. <TD CLASS=white><b>Outfit</b></TD>
  104. <TD><A HREF="index.php?subtopic=whoisonline&order=name" CLASS=white>Name</A></TD>
  105. <TD><A HREF="index.php?subtopic=whoisonline&order=level" CLASS=white>Level</A></TD>
  106. <TD><A HREF="index.php?subtopic=whoisonline&order=vocation" CLASS=white>Vocation</TD>
  107. </TR>
  108. '.$players_rows.'</TABLE>';
  109. //search bar
  110. $main_content .= '<BR><FORM ACTION="index.php?subtopic=characters" METHOD=post> <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
  111. }
  112. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement