PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/web/status.php

https://bitbucket.org/JabLuszko/hlstatsxce
PHP | 592 lines | 493 code | 39 blank | 60 comment | 109 complexity | e2428271309730416cbd274137faea3f MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. HLstatsX Community Edition - Real-time player and clan rankings and statistics
  4. Copyleft (L) 2008-20XX Nicholas Hastings (nshastings@gmail.com)
  5. http://www.hlxcommunity.com
  6. HLstatsX Community Edition is a continuation of
  7. ELstatsNEO - Real-time player and clan rankings and statistics
  8. Copyleft (L) 2008-20XX Malte Bayer (steam@neo-soft.org)
  9. http://ovrsized.neo-soft.org/
  10. ELstatsNEO is an very improved & enhanced - so called Ultra-Humongus Edition of HLstatsX
  11. HLstatsX - Real-time player and clan rankings and statistics for Half-Life 2
  12. http://www.hlstatsx.com/
  13. Copyright (C) 2005-2007 Tobias Oetzel (Tobi@hlstatsx.com)
  14. HLstatsX is an enhanced version of HLstats made by Simon Garner
  15. HLstats - Real-time player and clan rankings and statistics for Half-Life
  16. http://sourceforge.net/projects/hlstats/
  17. Copyright (C) 2001 Simon Garner
  18. This program is free software; you can redistribute it and/or
  19. modify it under the terms of the GNU General Public License
  20. as published by the Free Software Foundation; either version 2
  21. of the License, or (at your option) any later version.
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. GNU General Public License for more details.
  26. You should have received a copy of the GNU General Public License
  27. along with this program; if not, write to the Free Software
  28. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  29. For support and installation notes visit http://www.hlxcommunity.com
  30. */
  31. define('IN_HLSTATS', true);
  32. foreach ($_SERVER as $key => $entry) {
  33. if ($key !== 'HTTP_COOKIE') {
  34. $search_pattern = array('/<script>/', '/<\/script>/', '/[^A-Za-z0-9.\-\/=:;_?#&~]/');
  35. $replace_pattern = array('', '', '');
  36. $entry = preg_replace($search_pattern, $replace_pattern, $entry);
  37. if ($key == 'PHP_SELF') {
  38. if ((strrchr($entry, '/') !== '/hlstats.php') &&
  39. (strrchr($entry, '/') !== '/ingame.php') &&
  40. (strrchr($entry, '/') !== '/show_graph.php') &&
  41. (strrchr($entry, '/') !== '/sig.php') &&
  42. (strrchr($entry, '/') !== '/sig2.php') &&
  43. (strrchr($entry, '/') !== '/index.php') &&
  44. (strrchr($entry, '/') !== '/status.php') &&
  45. (strrchr($entry, '/') !== '/top10.php') &&
  46. (strrchr($entry, '/') !== '/config.php') &&
  47. (strrchr($entry, '/') !== '/') &&
  48. ($entry !== '')) {
  49. header('Location: http://'.$_SERVER['HTTP_HOST'].'/hlstats.php');
  50. exit;
  51. }
  52. }
  53. $_SERVER[$key] = $entry;
  54. }
  55. }
  56. require('config.php');
  57. header('Content-Type: text/html; charset=utf-8');
  58. // Check PHP configuration
  59. if (version_compare(phpversion(), "4.1.0", "<"))
  60. {
  61. error("HLstats requires PHP version 4.1.0 or newer (you are running PHP version " . phpversion() . ").");
  62. }
  63. // do not report NOTICE warnings
  64. error_reporting(E_ALL ^ E_NOTICE);
  65. ///
  66. /// Classes
  67. ///
  68. // Load database classes
  69. require(INCLUDE_PATH . "/class_db.php");
  70. require(INCLUDE_PATH . "/functions.php");
  71. ////
  72. //// Initialisation
  73. ////
  74. $db_classname = 'DB_' . DB_TYPE;
  75. if ( class_exists($db_classname) )
  76. {
  77. $db = new $db_classname(DB_ADDR, DB_USER, DB_PASS, DB_NAME, DB_PCONNECT);
  78. }
  79. else
  80. {
  81. error('Database class does not exist. Please check your config.php file for DB_TYPE');
  82. }
  83. $g_options = getOptions();
  84. if (!isset($g_options['scripturl']))
  85. $g_options['scripturl'] = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
  86. $g_options['scriptbase'] = str_replace('/status.php', '', $g_options['scripturl']);
  87. ////
  88. //// Main Config
  89. ////
  90. $game = 'css';
  91. if ((isset($_GET['game'])) && (is_string($_GET['game'])))
  92. $game = valid_request($_GET['game'], 0);
  93. $game_escaped = $db->escape($game);
  94. $server_id = '1';
  95. if ((isset($_GET['server_id'])) && (is_numeric($_GET['server_id'])))
  96. $server_id = valid_request($_GET['server_id'], 1);
  97. $width = '218';
  98. if ((isset($_GET['width'])) && (is_numeric($_GET['width'])))
  99. $width = valid_request($_GET['width'], 1);
  100. $body_color = 'ECF8FF';
  101. if ((isset($_GET['body_color'])) && (is_string($_GET['body_color'])))
  102. $body_color = valid_request($_GET['body_color'], 0);
  103. $background_color = 'ABCCD6';
  104. if (isset($_GET['bg_color']))
  105. $background_color = valid_request($_GET['bg_color'], 0);
  106. $color = '000000';
  107. if ((isset($_GET['color'])) && (is_string($_GET['color'])))
  108. $color = valid_request($_GET['color'], 0);
  109. $border_width = '1';
  110. if (isset($_GET['border_width']))
  111. $border_width = valid_request($_GET['border_width'], 1);
  112. $border_color = 'ABCCD6';
  113. if (isset($_GET['border_color']))
  114. $border_color = valid_request($_GET['border_color'], 0);
  115. $show_logo = '1';
  116. if ((isset($_GET['show_logo'])) && (is_string($_GET['show_logo'])))
  117. $show_logo = valid_request($_GET['show_logo'], 1);
  118. $small_fonts = '1';
  119. if ((isset($_GET['small_fonts'])) && (is_numeric($_GET['small_fonts'])))
  120. $small_fonts = valid_request($_GET['small_fonts'], 1);
  121. $server_name = '1';
  122. if ((isset($_GET['server_name'])) && (is_string($_GET['server_name'])))
  123. $server_name = valid_request($_GET['server_name'], 1);
  124. $server_url = '1';
  125. if ((isset($_GET['server_url'])) && (is_string($_GET['server_url'])))
  126. $server_url = valid_request($_GET['server_url'], 1);
  127. $map_image = '1';
  128. if ((isset($_GET['map_image'])) && (is_numeric($_GET['map_image'])))
  129. $map_image = valid_request($_GET['map_image'], 1);
  130. $show_summary = '1';
  131. if ((isset($_GET['show_summary'])) && (is_numeric($_GET['show_summary'])))
  132. $show_summary = valid_request($_GET['show_summary'], 1);
  133. $map_name = '1';
  134. if ((isset($_GET['map_name'])) && (is_numeric($_GET['map_name'])))
  135. $map_name = valid_request($_GET['map_name'], 1);
  136. $show_flags = '1';
  137. if ((isset($_GET['show_flags'])) && (is_numeric($_GET['show_flags'])))
  138. $show_flags = valid_request($_GET['show_flags'], 1);
  139. $show_players = '1';
  140. if ((isset($_GET['show_players'])) && (is_numeric($_GET['show_players'])))
  141. $show_players = valid_request($_GET['show_players'], 1);
  142. $show_teams = '1';
  143. if ((isset($_GET['show_teams'])) && (is_numeric($_GET['show_teams'])))
  144. $show_teams = valid_request($_GET['show_teams'], 1);
  145. $show_team_wins = '1';
  146. if ((isset($_GET['show_team_wins'])) && (is_numeric($_GET['show_team_wins'])))
  147. $show_team_wins = valid_request($_GET['show_team_wins'], 1);
  148. $show_map_wins = '1';
  149. if ((isset($_GET['show_map_wins'])) && (is_numeric($_GET['show_map_wins'])))
  150. $show_map_wins = valid_request($_GET['show_map_wins'], 1);
  151. $top_players = '10';
  152. if ((isset($_GET['top_players'])) && (is_numeric($_GET['top_players'])))
  153. $top_players = valid_request($_GET['top_players'], 1);
  154. $players_images = '1';
  155. if ((isset($_GET['players_images'])) && (is_numeric($_GET['players_images'])))
  156. $players_images = valid_request($_GET['players_images'], 1);
  157. $show_password = '';
  158. if ((isset($_GET['show_password'])) && (is_string($_GET['show_password'])))
  159. $show_password = valid_request($_GET['show_password'], 1);
  160. //// Entries
  161. $result = $db->query("
  162. SELECT
  163. IF(publicaddress != '', publicaddress, concat(address, ':', port)) AS addr,
  164. name,
  165. publicaddress,
  166. act_map,
  167. players,
  168. kills,
  169. headshots,
  170. map_started,
  171. act_players,
  172. max_players,
  173. map_ct_wins,
  174. map_ts_wins
  175. FROM
  176. hlstats_Servers
  177. WHERE
  178. serverId=$server_id");
  179. $server_data = $db->fetch_array($result);
  180. if ($small_fonts == 1)
  181. {
  182. $fsize = 'fSmall';
  183. }
  184. else
  185. {
  186. $fsize = 'fNormal';
  187. }
  188. if ($server_data['addr'] != '') {
  189. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
  190. echo '<html>';
  191. echo '<head>';
  192. echo '<title>'.$g_options["sitename"].'</title>';
  193. echo '<style type="text/css">{margin:0px;padding:0px;}</style>';
  194. echo '<link rel="stylesheet" type="text/css" href="hlstats.css">';
  195. echo '<link rel="stylesheet" type="text/css" href="styles/'.$g_options['style'].'">';
  196. echo '</head>';
  197. echo '<body style="background:#'.$body_color.';color:#'.$color.';" class="'.$fsize.'">';
  198. echo '<table border="0" cellpadding="0" cellspacing="0" style="border:'.$border_width.'px solid #'.$border_color.';background:#'.$background_color.';color:#'.$color.';width:'.$width.'px;">';
  199. if ($show_logo == 1)
  200. {
  201. echo '<tr style="background-image:url('.IMAGE_PATH.'/icons/title-background.gif);"><td align="center" colspan="2" class="'.$fsize.'">';
  202. $logo = file_exists(IMAGE_PATH.'/icons/shorttitle-'.$game.'.png');
  203. if ($logo) {
  204. if ($server_name == 1)
  205. {
  206. echo '<a target="_blank" href="'.$g_options["siteurl"].'"><img src="'.IMAGE_PATH.'/icons/shorttitle-'.$game.'.png" style="width:'.$width.'px;border:0px;" alt="'.$g_options['sitename'].'" title="'.$g_options['sitename'].'" /></a>';
  207. }
  208. else
  209. {
  210. echo '<a target="_blank" href="'.$g_options["siteurl"].'"><img src="'.IMAGE_PATH.'/icons/shorttitle-'.$game.'.png" style="width:'.$width.'px;border:0px;" alt="'.$server_data['name'].'" title="'.$server_data['name'].'" /></a>';
  211. }
  212. }
  213. else
  214. {
  215. echo '<a target="_blank" href="http://www.hlxcommunity.com" style="display:block;"><img src="'.IMAGE_PATH.'/icons/title-short.png" style="width:'.$width.'px;border:0px;" alt="Realtime player statistics for Halflife2 Source Engine" title="Realtime player statistics for Halflife2 Source Engine" /></a>';
  216. }
  217. echo '</td></tr>';
  218. }
  219. if ($server_name == 1)
  220. {
  221. echo '<tr><td align="center" colspan="2" class="'.$fsize.'">';
  222. echo '<a target="_blank" href="'.$g_options['scriptbase'].'" title="View statistics"><b>'.$server_data['name'].'</b></a>';
  223. echo '</td></tr>';
  224. }
  225. if ($server_url == 1)
  226. {
  227. echo '<tr><td align="center" colspan="2" class="'.$fsize.'">';
  228. echo '<a href="steam://connect/'.$server_data['addr'].'" title="Connent to Server"><b>'.$server_data['addr'].'</b></a>';
  229. echo '</td></tr>';
  230. }
  231. if ($show_password != '')
  232. {
  233. echo '<tr><td align="center" colspan="2" class="'.$fsize.'">';
  234. echo '<b>Password:&nbsp;'.$show_password.'</b>';
  235. echo '</td></tr>';
  236. }
  237. if ($map_image == 1)
  238. {
  239. $mapimg = getImage("/games/{$game}/maps/{$server_data['act_map']}");
  240. if (!file_exists($mapimg['path'])) {
  241. $mapimg = getImage("/games/{$game}/maps/default");
  242. if (!file_exists($mapimg['path'])) {
  243. $mapimg = getImage("/nomap");
  244. }
  245. }
  246. echo '<tr><td align="center" colspan="2">';
  247. echo '<a target="_blank" href="'.$g_options['scriptbase'].'/hlstats.php?mode=mapinfo&amp;map='.$server_data['act_map'].'&amp;game='.$game.'"><img src="'.$mapimg['url'].'" style="width:'.$width.'px;border:0px" alt="'.$server_data['act_map'].'" title="'.$server_data['act_map'].'" /></a>';
  248. echo '</td></tr>';
  249. }
  250. if ($show_summary == 1)
  251. {
  252. echo '<tr><td align="left" style="padding-left:2px" class="'.$fsize.'">';
  253. echo 'Players:';
  254. echo '</td><td align="right" style="padding-right:2px;" class="'.$fsize.'">';
  255. echo number_format($server_data['players']);
  256. echo '</td></tr>';
  257. echo '<tr><td align="left" style="padding-left:2px" class="'.$fsize.'">';
  258. echo 'Kills:';
  259. echo '</td><td align="right" style="padding-right:2px;" class="'.$fsize.'">';
  260. echo number_format($server_data['kills']);
  261. echo '</td></tr>';
  262. if ($server_data['headshots'] > 0)
  263. {
  264. echo '<tr><td align="left" style="padding-left:2px" class="'.$fsize.'">';
  265. echo 'Headshots:';
  266. echo '</td><td align="right" style="padding-right:2px;" class="'.$fsize.'">';
  267. echo number_format($server_data['headshots']);
  268. echo '</td></tr>';
  269. }
  270. }
  271. if ($map_name == 1) {
  272. echo '<tr><td align="left" style="padding-left:2px" class="'.$fsize.'">';
  273. echo 'Map:';
  274. echo '</td><td align="right" style="padding-right:2px;" class="'.$fsize.'">';
  275. echo $server_data['act_map'];
  276. echo '</td></tr>';
  277. }
  278. $stamp = $server_data['map_started']==0?0:time() - $server_data['map_started'];
  279. $hours = sprintf("%02d", floor($stamp / 3600));
  280. $min = sprintf("%02d", floor(($stamp % 3600) / 60));
  281. $sec = sprintf("%02d", floor($stamp % 60));
  282. echo '<tr><td align="left" style="padding-left:2px" class="'.$fsize.'">';
  283. echo 'Map Time:';
  284. echo '</td><td align="right" style="padding-right:2px;" class="'.$fsize.'">';
  285. echo $hours.':'.$min.':'.$sec;
  286. echo '</td></tr>';
  287. echo '<tr><td align="left" style="padding-left:2px;border-bottom:1px solid #000000;" class="'.$fsize.'">';
  288. echo 'Online:';
  289. echo '</td><td align="right" style="padding-right:2px;border-bottom:1px solid #000000;" class="'.$fsize.'">';
  290. echo $server_data['act_players'].'/'.$server_data['max_players'];
  291. echo '</td></tr>';
  292. if ($show_players == 1)
  293. {
  294. echo '<tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">';
  295. unset($team_colors);
  296. $statsdata = $db->query("
  297. SELECT
  298. team,
  299. name,
  300. teamkills,
  301. teamdeaths,
  302. teamheadshots,
  303. teamping,
  304. teamskill,
  305. teamshots,
  306. teamhits,
  307. teamjointime,
  308. IFNULL(playerlist_bgcolor,'#D5D5D5') as playerlist_bgcolor,
  309. IFNULL(playerlist_color,'#050505') AS playerlist_color,
  310. IFNULL(playerlist_index, 99 ) AS playerlist_index
  311. FROM
  312. hlstats_Teams
  313. RIGHT JOIN
  314. (SELECT
  315. team,
  316. sum( kills ) AS teamkills,
  317. sum( deaths ) AS teamdeaths,
  318. sum( headshots ) AS teamheadshots,
  319. avg( ping /2 ) AS teamping,
  320. avg( skill ) AS teamskill,
  321. sum( shots ) AS teamshots,
  322. sum( hits ) AS teamhits,
  323. sum( unix_timestamp( NOW( ) ) - connected ) AS teamjointime
  324. FROM
  325. hlstats_Livestats
  326. WHERE
  327. server_id = $server_id
  328. AND connected >0
  329. GROUP BY
  330. team
  331. ORDER BY
  332. teamkills
  333. ) teaminfo
  334. ON
  335. code = team
  336. AND
  337. hlstats_Teams.game = '{$game_escaped}'
  338. ORDER BY
  339. playerlist_index
  340. LIMIT 0 , 30
  341. ");
  342. $teamdata = array();
  343. $playerdata = array();
  344. $teamno = 0;
  345. while ($thisteam = $db->fetch_array($statsdata))
  346. {
  347. $teamdata[$teamno] = $thisteam;
  348. $thisteam_escaped = $db->escape($thisteam['team']);
  349. $pldata = $db->query("
  350. SELECT
  351. player_id,
  352. name,
  353. kills,
  354. deaths,
  355. headshots,
  356. ping,
  357. skill,
  358. shots,
  359. hits,
  360. connected,
  361. skill_change,
  362. cli_flag
  363. FROM
  364. hlstats_Livestats
  365. WHERE
  366. server_id = $server_id
  367. AND team = '{$thisteam_escaped}'
  368. ORDER BY
  369. kills DESC
  370. ");
  371. while ($thisplayer = $db->fetch_array($pldata))
  372. {
  373. $playerdata[$teamno][] = $thisplayer;
  374. }
  375. $teamno++;
  376. }
  377. $curteam = 0;
  378. while (isset($teamdata[$curteam]))
  379. {
  380. $j=0;
  381. $thisteam = $teamdata[$curteam];
  382. $teamcolor = 'background:'.$thisteam['playerlist_bgcolor'].';color:'.$thisteam['playerlist_color'];
  383. $bordercolor = 'background:'.$$thisteam['playerlist_bgcolor'].';color:'.$thisteam['playerlist_color'].';border-top:1px '.$thisteam['playerlist_color'].' solid';
  384. $team_display_name = htmlspecialchars($thisteam['name']);
  385. while (isset($playerdata[$curteam][$j]))
  386. {
  387. $thisplayer = $playerdata[$curteam][$j];
  388. echo '<tr style="'.$teamcolor.'">';
  389. echo '<td align="left" width="85%" style="'.$teamcolor.';padding-left:3px;" class="'.$fsize.'">';
  390. if (isset($thisplayer))
  391. {
  392. if (strlen($thisplayer['name'])>50)
  393. {
  394. $thisplayer['name'] = substr($thisplayer['name'], 0, 50);
  395. }
  396. echo '<a target="_blank" style="color:'.$thisteam['playerlist_color'].';" href="'.$g_options['scriptbase'].'/hlstats.php?mode=playerinfo&amp;player='.$thisplayer['player_id'].'" title="Player Details">';
  397. if ($show_flags == 1)
  398. {
  399. echo '<img src="'.getFlag($thisplayer['cli_flag']).'" alt="'.ucfirst(strtolower($thisplayer['cli_country'])).'" title="'.ucfirst(strtolower($thisplayer['cli_country'])).'">&nbsp;';
  400. }
  401. echo '<span style="vertical-align:middle;">'.htmlspecialchars($thisplayer['name'], ENT_COMPAT).'</span></a>';
  402. }
  403. else
  404. {
  405. echo '&nbsp;';
  406. }
  407. echo '</td>';
  408. echo '<td align="right" width="15%" style="'.$teamcolor.';padding-right:3px" class="'.$fsize.'">';
  409. if (isset($thisplayer))
  410. {
  411. echo $thisplayer['kills'];
  412. }
  413. else
  414. {
  415. echo '&nbsp;';
  416. }
  417. echo '&nbsp;:&nbsp;';
  418. if (isset($thisplayer))
  419. {
  420. echo $thisplayer['deaths'];
  421. }
  422. else
  423. {
  424. echo '&nbsp;';
  425. }
  426. echo '</td>';
  427. echo '</tr>';
  428. $j++;
  429. }
  430. if ($show_teams == 1)
  431. {
  432. if ($team_display_name)
  433. {
  434. echo '<tr style="'.$teamcolor.'">';
  435. echo '<td align="left" width="85%" style="'.$bordercolor.';'.$teamcolor.';padding-left:3px;" class="'.$fsize.'">';
  436. echo '&nbsp;<b>'.$team_display_name.'</b>';
  437. if ($show_team_wins == 1) {
  438. if (($map_teama_wins > 0) || ($map_teamb_wins > 0))
  439. {
  440. echo '&nbsp;('.$map_teama_wins.' wins)';
  441. }
  442. }
  443. echo '</td>';
  444. echo '<td align="right" width="15%" style="'.$bordercolor.';'.$teamcolor.';padding-right:3px" class="'.$fsize.'">';
  445. if (count($teamdata[$curteam]) > 0)
  446. {
  447. echo $teamdata[$curteam]['teamkills'];
  448. }
  449. else
  450. {
  451. echo '&nbsp;';
  452. }
  453. echo '&nbsp;:&nbsp;';
  454. if (count($teamdata[$curteam]) > 0)
  455. {
  456. echo $teamdata[$curteam]['teamdeaths'];
  457. }
  458. else
  459. {
  460. echo '&nbsp;';
  461. }
  462. echo '</td>';
  463. echo '</tr>';
  464. }
  465. }
  466. $curteam++;
  467. }
  468. // these variables are not set - so removing it
  469. /*
  470. if ((count($teama_players) > 0) || (count($teamb_players) > 0))
  471. {
  472. if ($show_map_wins == 1) {
  473. echo '<tr><td align="center" colspan="2" class="'.$fsize.'">';
  474. echo '<span style="color:'.$teamcolor.';font-weight:bold;">'.$teama_display_name.'&nbsp;'.$server_data['map_ct_wins'].'&nbsp;</span><span style="color:black;">:&nbsp;</span><span style="color:'.$teamcolor.';font-weight:bold;">'.$server_data['map_ts_wins'].'&nbsp;'.$teamb_display_name.'</span>';
  475. echo '</td></tr>';
  476. }
  477. }
  478. */
  479. if (count($teamdata) == 0)
  480. {
  481. echo '<tr><td colspan="2" align="left" style="background:#EFEFEF;color:black" class="'.$fsize.'">';
  482. echo '&nbsp;No Players';
  483. echo '</td></tr>';
  484. }
  485. echo '</table></td></tr>';
  486. }
  487. if ($top_players > 0)
  488. {
  489. $db->query("
  490. SELECT
  491. playerId,
  492. unhex(replace(hex(lastName), 'E280AE', '')) as lastName,
  493. flag,
  494. country,
  495. skill,
  496. IFNULL(kills/deaths, '-') AS kpd,
  497. IFNULL(ROUND((hits / shots * 100), 1), 0.0) AS acc
  498. FROM
  499. hlstats_Players
  500. WHERE
  501. game='{$game_escaped}'
  502. AND hideranking=0
  503. ORDER BY
  504. skill DESC,
  505. kpd DESC
  506. LIMIT 0,$top_players
  507. ");
  508. echo '<tr><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" style="width:100%">';
  509. echo '<tr><td align="center" colspan="2" style="border:1px solid #000000;" class="'.$fsize.'">';
  510. echo '<b>TOP '.$top_players.' Players</b>';
  511. echo '</td></tr>';
  512. while ($player = $db->fetch_array())
  513. {
  514. echo '<tr><td align="left" width="85%" style="padding-left:2px" class="'.$fsize.'">';
  515. $cut_pos = 15;
  516. if ($small_fonts == 1)
  517. $cut_pos += 10;
  518. $display_name = $player['lastName'];
  519. if (strlen($player['lastName']) > $cut_pos)
  520. $display_name = substr($player['lastName'], 0, $cut_pos);
  521. echo '<a target="_blank" href="'.$g_options["scriptbase"].'/hlstats.php?mode=playerinfo&amp;player='.$player['playerId'].'" title="Player Details">';
  522. if ($show_flags == 1)
  523. {
  524. if ($player['country'] == '')
  525. $player['country'] = 'Unknown Country';
  526. echo '<img src="'.getFlag($player['flag']).'" alt="'.ucfirst($player['country']).'" title="'.ucfirst($player['country']).'">&nbsp;';
  527. }
  528. else
  529. {
  530. if ($players_images == 1)
  531. {
  532. echo '<img src="'.IMAGE_PATH.'/player.gif" />&nbsp;';
  533. }
  534. }
  535. echo '<span style="vertical-align:middle;">'.htmlspecialchars($display_name, ENT_COMPAT).'</span></a>';
  536. echo '</td><td align="right" width="15%" style="padding-right:2px;" class="'.$fsize.'">';
  537. echo $player['skill'];
  538. echo '</td></tr>';
  539. }
  540. echo '</table></td></tr>';
  541. }
  542. echo '</table>';
  543. echo '</body>';
  544. echo '</html>';
  545. }
  546. ?>