<li>
			<a href="#points">How is the "points" rating calculated?</a><br />
		</li>
		<li>
			<a href="#weaponmods">What are all the weapon points modifiers?</a><br />
		</li>
		<li>
			<a href="#set">How can I set my real name, e-mail address, and homepage?</a><br />
		</li>
		<li>
			<a href="#hideranking">My rank is embarrassing. How can I opt out?</a>
		</li>
	</ol>

	<?php 
printSectionTitle('Answers');
?>

	<div style="margin-left:2%;">
		<h1 class="fTitle" style="padding-top:10px;"><a name="players">1. How are players tracked? Or, why is my name listed more than once?</a></h1><br /><br />
			<?php 
if ($g_options['Mode'] == 'NameTrack') {
    ?>
			Players are tracked by nickname. All statistics for any player using a particular name will be grouped under that name. It is not possible for a name to be listed more than once for each game.<br /><br />
			<?php 
} else {
    if ($g_options['Mode'] == 'LAN') {
        $uniqueid = 'IP Address';
        $uniqueid_plural = 'IP Addresses';
        ?>
			Players are tracked by IP Address. IP addresses are specific to a computer on a network.<br /><br />
if (isset($_GET['minkills'])) {
    $minkills = valid_request($_GET['minkills'], 1);
} else {
    $minkills = 1;
}
pageHeader(array($gamename, 'Player Rankings'), array($gamename => "%s?game={$game}", 'Player Rankings' => ''));
$rank_type = 0;
if (isset($_GET['rank_type'])) {
    $rank_type = valid_request(strval($_GET['rank_type']), 0);
}
// Autocomplete function below implemented by KingJ. Heavy modified to use HTML request instead of JSON.
?>

<div class="block">
	<?php 
printSectionTitle('Player Rankings');
?>
	<div class="subblock">
		<div style="float:left;">
			<script type="text/javascript" src="<?php 
echo INCLUDE_PATH;
?>
/js/Observer.js"></script>
			<script type="text/javascript" src="<?php 
echo INCLUDE_PATH;
?>
/js/Autocompleter.js"></script>
			<script type="text/javascript" src="<?php 
echo INCLUDE_PATH;
?>
/js/Autocompleter.Request.js"></script>
Exemple #3
0
} else {
    $minkills = 1;
}
pageHeader(array($gamename, 'Last 24h Connected'), array($gamename => "%s?game={$game}", 'Last 24h Connected' => ''));
$table = new Table(array(new TableColumn('lastName', 'Player', 'width=26&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('con_date', 'Last Connect', 'width=15&align=right'), new TableColumn('skill', 'Points', 'width=6&align=right'), new TableColumn('activity', 'Activity', 'width=10&sort=no&type=bargraph'), new TableColumn('kills', 'Kills', 'width=5&align=right'), new TableColumn('deaths', 'Deaths', 'width=5&align=right'), new TableColumn('headshots', 'Headshots', 'width=7&align=right'), new TableColumn('kpd', 'K:D', 'width=10&align=right'), new TableColumn('hpk', 'HS:K', 'width=5&align=right'), new TableColumn('acc', 'Accuracy', 'width=6&align=right&append=' . urlencode('%'))), 'playerId', 'last_event', 'skill', true);
$day_interval = 28;
#adjusted query to exclude bots that may not have hideRanking = 1
$resultCount = $db->query("\n\t\tSELECT\n\t\t\tCOUNT(*)\n\t\tFROM\n\t\t\thlstats_Players\n\t\tWHERE\n\t\t\thlstats_Players.game = '{$game}'\n\t\t\tAND hlstats_Players.hideranking = 0\n\t\t\tAND hlstats_Players.lastName NOT REGEXP '^BOT|^[(*)]'\n\t\t\tAND hlstats_Players.kills >= {$minkills}\n\t\t\tAND hlstats_Players.last_event >= {$time}\n\t");
list($numitems) = $db->fetch_row($resultCount);
#adjusted query to exclude bots that may not have hideRanking = 1
$result = $db->query("\n\t\tSELECT\n\t\t\thlstats_Players.playerId,\n\t\t\tFROM_UNIXTIME(last_event,'%Y.%m.%d %T') as con_date,\n\t\t\thlstats_Players.flag,\n                        unhex(replace(hex(hlstats_Players.lastName), 'E280AE', '')) as lastName,\n\t\t\thlstats_Players.skill,\n\t\t\thlstats_Players.kills,\n\t\t\thlstats_Players.deaths,\n\t\t\tIFNULL(ROUND(hlstats_Players.kills / IF(hlstats_Players.deaths = 0, 1, hlstats_Players.deaths), 2), '-') AS kpd,\n\t\t\thlstats_Players.headshots,\n\t\t\tIFNULL(ROUND(hlstats_Players.headshots / hlstats_Players.kills, 2), '-') AS hpk,\n\t\t\tIFNULL(ROUND((hlstats_Players.hits / hlstats_Players.shots * 100), 0), 0) AS acc,\n\t\t\tactivity\n\t\tFROM\n\t\t\thlstats_Players\n\t\tWHERE\n\t\t\thlstats_Players.game = '{$game}'\n\t\t\tAND hlstats_Players.hideranking = 0\n\t\t\tAND hlstats_Players.lastName NOT REGEXP '^BOT|^[(*)]'\n\t\t\tAND hlstats_Players.kills >= {$minkills}\n\t\t\tAND hlstats_Players.last_event >= {$time}\n\t\tORDER BY\n\t\t\t{$table->sort} {$table->sortorder},\n\t\t\t{$table->sort2} {$table->sortorder},\n\t\t\thlstats_Players.lastName ASC\n\t\tLIMIT\n\t\t\t{$table->startitem},\n\t\t\t{$table->numperpage}\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Last 24h Connected');
?>
		<div class="subblock">
			<div style="float:left;">
				<form method="get" action="<?php 
echo $g_options['scripturl'];
?>
">
					<input type="hidden" name="mode" value="search" />
					<input type="hidden" name="game" value="<?php 
echo $game;
?>
" />
					<input type="hidden" name="st" value="player" />
					<strong>&#8226;</strong> Find a player:
					<input type="text" name="q" size="20" maxlength="64" class="textbox" />
pageHeader(array($gamename, 'Chat History', $pl_name), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Player Rankings' => $g_options['scripturl'] . "?mode=players&game={$game}", 'Player Details' => $g_options['scripturl'] . "?mode=playerinfo&player={$player}", 'Chat History' => ''), $playername);
flush();
$table = new Table(array(new TableColumn('eventTime', 'Date', 'width=16'), new TableColumn('message', 'Message', 'width=44&sort=no&append=.&embedlink=yes'), new TableColumn('serverName', 'Server', 'width=24'), new TableColumn('map', 'Map', 'width=16')), 'eventTime', 'eventTime', 'serverName', false, 50, 'page', 'sort', 'sortorder');
$surl = $g_options['scripturl'];
$whereclause = "hlstats_Events_Chat.playerId = {$player} ";
$filter = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : "";
if (!empty($filter)) {
    $whereclause .= "AND MATCH (hlstats_Events_Chat.message) AGAINST ('" . $db->escape($filter) . "' in BOOLEAN MODE)";
}
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Chat.eventTime,\r\n\t\t\tIF(hlstats_Events_Chat.message_mode=2, CONCAT('(Team) ', hlstats_Events_Chat.message), IF(hlstats_Events_Chat.message_mode=3, CONCAT('(Squad) ', hlstats_Events_Chat.message), hlstats_Events_Chat.message)) AS message,\r\n\t\t\thlstats_Servers.name AS serverName,\r\n\t\t\thlstats_Events_Chat.map\r\n\t\tFROM\r\n\t\t\thlstats_Events_Chat\r\n\t\tLEFT JOIN \r\n\t\t\thlstats_Servers\r\n\t\tON\r\n\t\t\thlstats_Events_Chat.serverId = hlstats_Servers.serverId\r\n\t\tWHERE\r\n\t\t\t{$whereclause}\t\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT\r\n\t\t\t{$table->startitem},\r\n\t\t\t{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*)\r\n\t\tFROM\r\n\t\t\thlstats_Events_Chat\r\n\t\tLEFT JOIN \r\n\t\t\thlstats_Servers\r\n\t\tON\r\n\t\t\thlstats_Events_Chat.serverId = hlstats_Servers.serverId\r\n\t\tWHERE\r\n\t\t\t{$whereclause}\r\n\t");
list($numitems) = $db->fetch_row($resultCount);
?>
<div class="block">
<?php 
printSectionTitle('Player Chat History (Last ' . $g_options['DeleteDays'] . ' Days)');
?>
	<div class="subblock">
		<div style="float:left;">
			<span>
			<form method="get" action="<?php 
echo $g_options['scripturl'];
?>
" style="margin:0px;padding:0px;">
				<input type="hidden" name="mode" value="chathistory" />
				<input type="hidden" name="player" value="<?php 
echo $player;
?>
" />
				<strong>&#8226;</strong>
				Filter: <input type="text" name="filter" value="<?php 
$db->query("SELECT name FROM hlstats_Games WHERE code='{$game}'");
if ($db->num_rows() < 1) {
    error("No such game '{$game}'.");
}
list($gamename) = $db->fetch_row();
$db->free_result();
pageHeader(array($gamename, 'Ribbon Details', $act_name), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Ribbons' => $g_options['scripturl'] . "mode=awards&game={$game}&tab=ribbons", 'Ribbon Details' => ''), $act_name);
$table = new Table(array(new TableColumn('playerName', 'Player', 'width=45&align=left&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('numawards', 'Daily awards', 'width=10&align=right&append=' . urlencode(' times')), new TableColumn('awardName', '', 'width=40&align=left')), 'playerId', 'numawards', 'playerName', true, 50);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\tflag,\r\n\t\t\tlastName AS playerName,\r\n\t\t\thlstats_Players.playerId,\r\n\t\t\thlstats_Awards.name as awardName,\r\n\t\t\tCOUNT(hlstats_Awards.name) AS numawards\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Players_Awards\r\n\t\t\tON (\r\n\t\t\t    hlstats_Players_Awards.playerId=hlstats_Players.playerId AND\r\n\t\t\t    hlstats_Players_Awards.game=hlstats_Players.game\t\t\t    \r\n\t\t\t    )\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Awards \r\n\t\t\tON (\r\n\t\t\t    hlstats_Players_Awards.awardId=hlstats_Awards.awardId AND\r\n\t\t\t    hlstats_Players_Awards.game=hlstats_Awards.game\t\t\t    \r\n\t\t\t    )\r\n\t\tWHERE\r\n\t\t\thlstats_Awards.code = '{$awardcode}' AND\r\n\t\t\thlstats_Players.game = '{$game}' AND\r\n\t\t\thlstats_Players.hideranking<>'1'\r\n\t\tGROUP BY\r\n\t\t\tflag,\r\n\t\t\tlastName,\r\n\t\t\thlstats_Players.playerId\r\n\t\tHAVING\r\n\t\t\tCOUNT(hlstats_Awards.name) >= {$awardmin}  \t\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT {$table->startitem},{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tflag,\r\n\t\t\tlastName AS playerName,\r\n\t\t\thlstats_Players.playerId,\r\n\t\t\thlstats_Awards.name as awardName,\r\n\t\t\tCOUNT(hlstats_Awards.name) AS numawards\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Players_Awards\r\n\t\t\tON (\r\n\t\t\t    hlstats_Players_Awards.playerId=hlstats_Players.playerId AND\r\n\t\t\t    hlstats_Players_Awards.game=hlstats_Players.game\t\t\t    \r\n\t\t\t    )\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Awards \r\n\t\t\tON (\r\n\t\t\t    hlstats_Players_Awards.awardId=hlstats_Awards.awardId AND\r\n\t\t\t    hlstats_Players_Awards.game=hlstats_Awards.game\t\t\t    \r\n\t\t\t    )\r\n\t\tWHERE\r\n\t\t\thlstats_Awards.code = '{$awardcode}' AND\r\n\t\t\thlstats_Players.game = '{$game}' AND\r\n\t\t\thlstats_Players.hideranking<>'1'\r\n\t\tGROUP BY\r\n\t\t\tflag,\r\n\t\t\tlastName,\r\n\t\t\thlstats_Players.playerId\r\n\t\tHAVING\r\n\t\t\tCOUNT(hlstats_Awards.name) >= {$awardmin}  \t\r\n\t");
$numitems = mysql_num_rows($resultCount);
?>

<div class="block">
	<?php 
printSectionTitle('Ribbon Details');
?>
	<div class="subblock">
		<div style="float:right;">
			Back to <a href="<?php 
echo $g_options['scripturl'] . "?mode=awards&amp;game={$game}&tab=ribbons";
?>
">Ribbons</a>
		</div>
		<div style="clear:both;"></div>
	</div>
	<br /><br />
<?php 
echo '<img src="' . IMAGE_PATH . "/games/{$game}/ribbons/{$image}\" alt=\"\" /> <b>{$act_name}</b>";
$table->draw($result, $numitems, 95, 'center');
?>
            echo '-';
        }
        ?>
</td>
				</tr>
<?php 
    }
    ?>
	
				</table>
		
		</div><br /><br />
		<br />
		
<?php 
    printSectionTitle('General Statistics');
    $nonhiddengamestring = preg_replace('/,$/', ')', $nonhiddengamestring);
    $result = $db->query("SELECT COUNT(playerId) FROM hlstats_Players WHERE game IN {$nonhiddengamestring}");
    list($num_players) = $db->fetch_row($result);
    $num_players = number_format($num_players);
    $result = $db->query("SELECT COUNT(clanId) FROM hlstats_Clans WHERE game IN {$nonhiddengamestring}");
    list($num_clans) = $db->fetch_row($result);
    $num_clans = number_format($num_clans);
    $result = $db->query("SELECT COUNT(serverId) FROM hlstats_Servers WHERE game IN {$nonhiddengamestring}");
    list($num_servers) = $db->fetch_row($result);
    $num_servers = number_format($num_servers);
    $result = $db->query("SELECT SUM(kills) FROM hlstats_Servers WHERE game IN {$nonhiddengamestring}");
    list($num_kills) = $db->fetch_row($result);
    $num_kills = number_format($num_kills);
    $result = $db->query("\r\n\t\t\tSELECT \r\n\t\t\t\teventTime\r\n\t\t\tFROM\r\n\t\t\t\thlstats_Events_Frags\r\n\t\t\tORDER BY\r\n\t\t\t\tid DESC\r\n\t\t\tLIMIT 1\r\n\t\t");
    list($lastevent) = $db->fetch_row($result);
    die("No player exists with ID #{$id}");
}
$data = $db->fetch_array($result);
echo '<span class="fTitle">';
echo $data['lastName'];
echo '</span>';
echo '<span class="fNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . '<a href="' . $g_options['scripturl'] . "?mode=playerinfo&amp;player={$id}&amp;" . strip_tags(SID) . '">' . '(View Player Details)</a></span>';
?>
<br /><br />

<table width="60%" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td class="fNormal"><?php 
$proppage->draw($data);
?>
	<center><input type="submit" value="  Apply  " class="submit" /></center></td>
</tr>
</table>
</form>

<?php 
$tblIps = new Table(array(new TableColumn('ipAddress', 'IP Address', 'width=40'), new TableColumn('eventTime', 'Last Used', 'width=60')), 'ipAddress', 'eventTime', 'eventTime');
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\tipAddress,\r\n\t\t\teventTime\r\n\t\tFROM\r\n\t\t\thlstats_Events_Connects\r\n\t\tWHERE\r\n\t\t\tplayerId = {$playerId}\r\n\t\tGROUP BY\r\n\t\t\tipAddress\r\n\t\tORDER BY\r\n\t\t\teventTime DESC\r\n\t");
?>
<div class="block">
<?php 
printSectionTitle('Player IP Addresses');
$tblIps->draw($result, 50, 50);
?>
</div><br /><br />
$db->query("SELECT name FROM hlstats_Games WHERE code='{$game}'");
if ($db->num_rows() < 1) {
    error("No such game '{$game}'.");
}
list($gamename) = $db->fetch_row();
$db->free_result();
pageHeader(array($gamename, 'Award Details', $awardname), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Awards Statistics' => $g_options['scripturl'] . "?mode=awards&game={$game}", 'Awards Details' => ''), $awardname);
$table = new Table(array(new TableColumn('awardTime', 'Day', 'width=20&align=left'), new TableColumn('lastName', 'Player', 'width=40&align=left&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('count', 'Count for the Day', 'width=35&align=right&append=' . urlencode(" {$awardverb}"))), 'playerId', 'awardTime', 'lastName', true, 30);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players_Awards.playerId,\r\n\t\t\tawardTime,\r\n\t\t\tlastName,\r\n\t\t\tflag,\r\n\t\t\tcount\r\n\t\tFROM\r\n\t\t\thlstats_Players_Awards\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Players\r\n\t\tON\r\n\t\t\thlstats_Players_Awards.playerId = hlstats_Players.playerId\r\n\t\tWHERE\r\n\t\t\tawardid={$award}\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT {$table->startitem},{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tawardTime\r\n\t\tFROM\r\n\t\t\thlstats_Players_Awards\r\n\t\tWHERE\r\n\t\t\tawardid={$award}\t\r\n\t");
$numitems = mysql_num_rows($resultCount);
?>

<div class="block">
	<?php 
printSectionTitle('Daily Award Details');
?>
	<div class="subblock">
		<div style="float:right;">
			Back to <a href="<?php 
echo $g_options['scripturl'] . "?mode=awards&amp;game={$game}";
?>
">Daily Awards</a>
		</div>
		<div style="clear:both;"></div>
	</div>
	<br /><br />
	<?php 
$img = IMAGE_PATH . "/games/{$game}/dawards/" . strtolower($awardtype) . '_' . strtolower($awardcode) . '.png';
if (!is_file($img)) {
    $img = IMAGE_PATH . '/award.png';
">Action Statistics</a>
		</div>
	</div>
	<div style="clear:both;padding:2px;"></div>
</div>
<?php 
$table->draw($result, $numitems, 95, 'center');
if ($actiondata['for_PlayerPlayerActions'] == 1) {
    $table = new Table(array(new TableColumn('playerName', 'Player', 'width=45&align=left&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('obj_count', 'Times Victimized', 'width=25&align=right'), new TableColumn('obj_bonus', 'Skill Bonus Total', 'width=25&align=right&sort=no')), 'victimId', 'obj_count', 'playerName', true, 40, 'vpage');
    $result = $db->query("\r\n\t\t\tSELECT\r\n\t\t\t\thlstats_Events_PlayerPlayerActions.victimId,\r\n\t\t\t\thlstats_Players.lastName AS playerName,\r\n\t\t\t\thlstats_Players.flag as flag,\r\n\t\t\t\tCOUNT(hlstats_Events_PlayerPlayerActions.id) AS obj_count,\r\n\t\t\t\tCOUNT(hlstats_Events_PlayerPlayerActions.id) * hlstats_Actions.reward_player * -1 AS obj_bonus\r\n\t\t\tFROM\r\n\t\t\t\thlstats_Events_PlayerPlayerActions, hlstats_Players, hlstats_Actions\r\n\t\t\tWHERE\r\n\t\t\t\thlstats_Actions.code = '{$action_escaped}' AND\r\n\t\t\t\thlstats_Players.game = '{$game_escaped}' AND\r\n\t\t\t\thlstats_Players.playerId = hlstats_Events_PlayerPlayerActions.victimId AND\r\n\t\t\t\thlstats_Events_PlayerPlayerActions.actionId = hlstats_Actions.id AND\r\n\t\t\t\thlstats_Players.hideranking = '0'\r\n\t\t\tGROUP BY\r\n\t\t\t\thlstats_Events_PlayerPlayerActions.victimId\r\n\t\t\tORDER BY\r\n\t\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\t\tLIMIT {$table->startitem},{$table->numperpage}\r\n\t\t");
    $resultCount = $db->query("\r\n\t\t\tSELECT\r\n\t\t\t\tCOUNT(DISTINCT hlstats_Events_PlayerPlayerActions.victimId),\r\n\t\t\t\tCOUNT(hlstats_Events_PlayerPlayerActions.Id)\r\n\t\t\tFROM\r\n\t\t\t\thlstats_Events_PlayerPlayerActions, hlstats_Players, hlstats_Actions\r\n\t\t\tWHERE\r\n\t\t\t\thlstats_Actions.code = '{$action_escaped}' AND\r\n\t\t\t\thlstats_Players.game = '{$game_escaped}' AND\r\n\t\t\t\thlstats_Players.playerId = hlstats_Events_PlayerPlayerActions.victimId AND\r\n\t\t\t\thlstats_Events_PlayerPlayerActions.actionId = hlstats_Actions.id AND\r\n\t\t\t\thlstats_Players.hideranking = '0'\r\n\t\t");
    list($numitems, $totalact) = $db->fetch_row($resultCount);
    ?>
<div class="block">
	<a name="victims"><?php 
    printSectionTitle("Action Victim Details");
    ?>
</a>
	<div class="subblock">
		<div style="float:left;">
			<strong>Victims of <?php 
    echo $act_name;
    ?>
</strong> (Last <?php 
    echo $g_options['DeleteDays'];
    ?>
 Days)
		</div>
	</div>
	<div style="clear:both;padding:2px;"></div>
</div>
    $gamename = ucfirst($game);
} else {
    list($gamename) = $db->fetch_row();
}
pageHeader(array($gamename, 'Session History', $pl_name), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Player Rankings' => $g_options['scripturl'] . "?mode=players&game={$game}", 'Player Details' => $g_options['scripturl'] . "?mode=playerinfo&player={$player}", 'Session History' => ''), $playername);
flush();
$table = new Table(array(new TableColumn('eventTime', 'Date', 'width=11'), new TableColumn('skill_change', 'Skill Change', 'width=10&align=right&skill_change=1'), new TableColumn('skill', 'Points', 'width=10&align=right'), new TableColumn('connection_time', 'Time', 'width=13&align=right&type=timestamp'), new TableColumn('kills', 'Kills', 'width=7&align=right'), new TableColumn('deaths', 'Deaths', 'width=7&align=right'), new TableColumn('kpd', 'K:D', 'width=7&align=right'), new TableColumn('headshots', 'HS', 'width=7&align=right'), new TableColumn('hpk', 'HS:K', 'width=7&align=right'), new TableColumn('suicides', 'Suicides', 'width=7&align=right'), new TableColumn('teamkills', 'TKs', 'width=7&align=right'), new TableColumn('kill_streak', 'Kill Strk', 'width=7&align=right')), 'eventTime', 'eventTime', 'skill_change', false, 50, 'page', 'sort', 'sortorder');
$surl = $g_options['scripturl'];
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players_History.eventTime,\r\n\t\t\thlstats_Players_History.skill_change,\r\n\t\t\thlstats_Players_History.skill,\r\n\t\t\thlstats_Players_History.kills,\r\n\t\t\thlstats_Players_History.deaths,\r\n\t\t\thlstats_Players_History.headshots,\r\n\t\t\thlstats_Players_History.suicides,\r\n\t\t\thlstats_Players_History.connection_time,\r\n\t\t\tROUND(hlstats_Players_History.kills/(IF(hlstats_Players_History.deaths = 0, 1, hlstats_Players_History.deaths)), 2) AS kpd,\n\t\t\tROUND(hlstats_Players_History.headshots/(IF(hlstats_Players_History.kills = 0, 1, hlstats_Players_History.kills)), 2) AS hpk,\r\n\t\t\thlstats_Players_History.teamkills,\r\n\t\t\thlstats_Players_History.kill_streak,\r\n\t\t\thlstats_Players_History.death_streak,\r\n\t\t\thlstats_Players_History.skill_change AS last_skill_change\r\n\t\tFROM\r\n\t\t\thlstats_Players_History\r\n\t\tWHERE\r\n\t\t\thlstats_Players_History.playerId = {$player}\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT\r\n\t\t\t{$table->startitem},\r\n\t\t\t{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*)\r\n\t\tFROM\r\n\t\t\thlstats_Players_History\r\n\t\tWHERE\r\n\t\t\thlstats_Players_History.playerId = {$player}\r\n\t");
list($numitems) = $db->fetch_row($resultCount);
?>

<div class="block">
<?php 
printSectionTitle('Player Session History');
if ($numitems > 0) {
    $table->draw($result, $numitems, 95);
}
?>
<br /><br />
	<div class="subblock">
		<div style="float:left;">
			Items above are generated from the last <?php 
echo $g_options['DeleteDays'];
?>
 days.
		</div>
		<div style="float:right;">
<?php 
$db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players.lastName\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.playerId = '{$player}'\r\n\t");
    die('Do not access this file directly.');
}
flush();
$tblPlayerActions = new Table(array(new TableColumn('description', 'Action', 'width=45&link=' . urlencode("mode=actioninfo&amp;action=%k&amp;game={$game}")), new TableColumn('obj_count', 'Earned', 'width=25&align=right&append=+times'), new TableColumn('obj_bonus', 'Accumulated Points', 'width=25&align=right')), 'code', 'obj_count', 'description', true, 9999, 'obj_page', 'obj_sort', 'obj_sortorder', 'tabteams', 'desc', true);
$result = $db->query("\r\n\t\t(\r\n\t\tSELECT\r\n\t\t\thlstats_Actions.code,\r\n\t\t\thlstats_Actions.description,\r\n\t\t\tCOUNT(hlstats_Events_PlayerActions.id) AS obj_count,\r\n\t\t\tSUM(hlstats_Events_PlayerActions.bonus) AS obj_bonus\r\n\t\tFROM\r\n\t\t\thlstats_Actions\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Events_PlayerActions\r\n\t\tON\r\n\t\t\thlstats_Events_PlayerActions.actionId = hlstats_Actions.id\r\n\t\tWHERE\r\n\t\t\thlstats_Events_PlayerActions.playerId = {$player}\r\n\t\tGROUP BY\r\n\t\t\thlstats_Actions.id\r\n\t\t)\r\n\t\tUNION ALL\r\n\t\t(\r\n\t\tSELECT\r\n\t\t\thlstats_Actions.code,\r\n\t\t\thlstats_Actions.description,\r\n\t\t\tCOUNT(hlstats_Events_PlayerPlayerActions.id) AS obj_count,\r\n\t\t\tSUM(hlstats_Events_PlayerPlayerActions.bonus) AS obj_bonus\r\n\t\tFROM\r\n\t\t\thlstats_Actions\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Events_PlayerPlayerActions\r\n\t\tON\r\n\t\t\thlstats_Events_PlayerPlayerActions.actionId = hlstats_Actions.id\r\n\t\tWHERE\r\n\t\t\thlstats_Events_PlayerPlayerActions.playerId = {$player}\r\n\t\tGROUP BY\r\n\t\t\thlstats_Actions.id\r\n\t\t)\r\n\t\tORDER BY\r\n\t\t\t{$tblPlayerActions->sort} {$tblPlayerActions->sortorder},\r\n\t\t\t{$tblPlayerActions->sort2} {$tblPlayerActions->sortorder}\r\n\t");
$numitems = $db->num_rows($result);
if ($numitems > 0) {
    ?>
		<div style="clear:both;padding-top:20px;"></div>
<?php 
    printSectionTitle('Player Actions *');
    $tblPlayerActions->draw($result, $numitems, 95);
    ?>
		<br /><br />
<?php 
}
$tblPlayerPlayerActionsV = new Table(array(new TableColumn('description', 'Action', 'width=45&link=' . urlencode("mode=actioninfo&amp;action=%k&amp;game={$game}#victims")), new TableColumn('obj_count', 'Earned Against', 'width=25&align=right&append=+times'), new TableColumn('obj_bonus', 'Accumulated Points', 'width=25&align=right')), 'code', 'obj_count', 'description', true, 9999, 'ppa_page', 'ppa_sort', 'ppa_sortorder', 'tabteams', 'desc', true);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Actions.code,\r\n\t\t\thlstats_Actions.description,\r\n\t\t\tCOUNT(hlstats_Events_PlayerPlayerActions.id) AS obj_count,\r\n\t\t\tSUM(hlstats_Events_PlayerPlayerActions.bonus) * -1 AS obj_bonus\r\n\t\tFROM\r\n\t\t\thlstats_Actions\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Events_PlayerPlayerActions\r\n\t\tON\r\n\t\t\thlstats_Events_PlayerPlayerActions.actionId = hlstats_Actions.id\r\n\t\tWHERE\r\n\t\t\thlstats_Events_PlayerPlayerActions.victimId = {$player}\r\n\t\tGROUP BY\r\n\t\t\thlstats_Actions.id\r\n\t\tORDER BY\r\n\t\t\t{$tblPlayerPlayerActionsV->sort} {$tblPlayerPlayerActionsV->sortorder},\r\n\t\t\t{$tblPlayerPlayerActionsV->sort2} {$tblPlayerPlayerActionsV->sortorder}\r\n\t");
$numitemsv = $db->num_rows($result);
if ($numitemsv > 0) {
    if ($numitems == 0) {
        ?>
		<div style="clear:both;padding-top:20px;"></div>
<?php 
    }
    printSectionTitle('Victims of Player-Player Actions *');
    $tblPlayerPlayerActionsV->draw($result, $numitems, 95);
    ?>
		<br /><br />
<?php 
}
$db->query("SELECT name FROM hlstats_Games WHERE code='{$game}'");
if ($db->num_rows() != 1) {
    error('Invalid or no game specified.');
} else {
    list($gamename) = $db->fetch_row();
}
pageHeader(array($gamename, 'Weapon Details', htmlspecialchars($wep_name)), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Weapon Statistics' => $g_options['scripturl'] . "?mode=weapons&game={$game}", 'Weapon Details' => ''), $wep_name);
$table = new Table(array(new TableColumn('killerName', 'Player', 'width=60&align=left&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('frags', ucfirst($weapon) . ' kills', 'width=15&align=right'), new TableColumn('headshots', 'Headshots', 'width=15&align=right'), new TableColumn('hpk', 'Hpk', 'width=5&align=right')), 'killerId', 'frags', 'killerName', true, 50);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Players.lastName AS killerName,\r\n\t\t\thlstats_Players.flag as flag,\r\n\t\t\tCOUNT(hlstats_Events_Frags.weapon) AS frags,\r\n\t\t\tSUM(hlstats_Events_Frags.headshot=1) as headshots,\r\n\t\t\tIFNULL(SUM(hlstats_Events_Frags.headshot=1) / Count(hlstats_Events_Frags.weapon), '-') AS hpk\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags,\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.playerId = hlstats_Events_Frags.killerId\r\n\t\t\tAND hlstats_Events_Frags.weapon='{$weapon}'\r\n\t\t\tAND hlstats_Players.game='{$game}'\r\n\t\t\tAND hlstats_Players.hideranking = 0\r\n\t\tGROUP BY\r\n\t\t\thlstats_Events_Frags.killerId\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT {$table->startitem},{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(DISTINCT hlstats_Events_Frags.killerId),\r\n\t\t\tSUM(hlstats_Events_Frags.weapon='{$weapon}'),\r\n\t\t\tSUM(hlstats_Events_Frags.weapon='{$weapon}' AND hlstats_Events_Frags.headshot=1)\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags,\r\n\t\t\thlstats_Servers\r\n\t\tWHERE\r\n\t\t\thlstats_Servers.serverId = hlstats_Events_Frags.serverId\r\n\t\t\tAND hlstats_Events_Frags.weapon='{$weapon}'\r\n\t\t\tAND hlstats_Servers.game='{$game}'\r\n\t");
list($numitems, $totalkills, $totalheadshots) = $db->fetch_row($resultCount);
?>

<div class="block">
	<?php 
printSectionTitle('Weapon Details');
?>
    <div class="subblock">
	<?php 
// figure out URL and absolute path of image
$image = getImage("/games/{$game}/weapons/{$weapon}");
if ($image) {
    $wep_content = '<img src="' . $image['url'] . "\"  alt=\"{$weapon}\" />";
} else {
    $wep_content = "<strong>{$wep_name}</strong>: ";
}
?>
		<div style="float:left;">
			<?php 
echo $wep_content;
?>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

For support and installation notes visit http://www.hlxcommunity.com
*/
if (!defined('IN_HLSTATS')) {
    die('Do not access this file directly.');
}
flush();
$tblServers = new Table(array(new TableColumn('server', 'Server', 'width=26&align=left'), new TableColumn('kills', 'Kills', 'width=6&align=right'), new TableColumn('kpercent', '%', 'width=5&sort=no&align=right&append=' . urlencode('%')), new TableColumn('kpercent', 'Ratio', 'width=15&sort=no&type=bargraph'), new TableColumn('deaths', 'Deaths', 'width=6&align=right'), new TableColumn('kpd', 'K:D', 'width=5&align=right'), new TableColumn('headshots', 'Headshots', 'width=6&align=right'), new TableColumn('hpercent', 'Percentage of Headshots', 'width=16&sort=no&type=bargraph'), new TableColumn('hpercent', '%', 'width=5&sort=no&align=right&append=' . urlencode('%')), new TableColumn('hpk', 'HS:K', 'width=5&align=right')), 'server', 'kills', 'kills', true, 9999, 'server_page', 'server_sort', 'server_sortorder', 'tabmaps', 'desc', true);
// leave the join on this one, we do groupings..
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Servers.name AS server,\r\n\t\t\tSUM(hlstats_Events_Frags.killerId = {$player}) AS kills,\r\n\t\t\tSUM(hlstats_Events_Frags.victimId = {$player}) AS deaths,\r\n\t\t\tSUM(hlstats_Events_Frags.killerId = {$player}) / IF(SUM(hlstats_Events_Frags.victimId = {$player}) = 0, 1, SUM(hlstats_Events_Frags.victimId = {$player})) AS kpd,\r\n\t\t\tROUND(SUM(hlstats_Events_Frags.killerId = {$player}) / {$realkills} * 100, 2) AS kpercent,\r\n\t\t\tROUND(SUM(hlstats_Events_Frags.victimId = {$player}) / {$realdeaths} * 100, 2) AS dpercent,\r\n\t\t\tSUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1) AS headshots,\r\n\t\t\tIFNULL(SUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1) / SUM(hlstats_Events_Frags.killerId = {$player}), '-') AS hpk,\r\n\t\t\tROUND(SUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1) / {$realheadshots} * 100, 2) AS hpercent\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Servers\r\n\t\tON\r\n\t\t\thlstats_Servers.serverId = hlstats_Events_Frags.serverId\r\n\t\tWHERE\r\n\t\t\thlstats_Servers.game = '{$game}'\r\n\t\t\tAND hlstats_Events_Frags.killerId = '{$player}'\r\n\t\t\tOR hlstats_Events_Frags.victimId = '{$player}'\r\n\t\tGROUP BY\r\n\t\t\thlstats_Servers.name\r\n\t\tORDER BY\r\n\t\t\t{$tblServers->sort} {$tblServers->sortorder},\r\n\t\t\t{$tblServers->sort2} {$tblServers->sortorder}\r\n\t");
$numitems = $db->num_rows($result);
if ($numitems > 0) {
    printSectionTitle('Server Activity *');
    $tblServers->draw($result, $numitems, 95);
    ?>
	<br /><br />
<?php 
}
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

For support and installation notes visit http://www.hlxcommunity.com
*/
if (!defined('IN_HLSTATS')) {
    die('Do not access this file directly.');
}
pageHeader(array('Admin'), array('Admin' => ''));
?>
<div class="block">
	<?php 
printSectionTitle('Authorization Required');
?>
	<div class="subblock">
	<?php 
if ($this->error) {
    ?>
	<img src="<?php 
    echo IMAGE_PATH;
    ?>
/warning.gif" style="padding-right:5px;">
	<?php 
    echo "<span class=\"fTitle\" style=\"font-weight:bold;\">{$this->error}</span><br /><br />";
}
?>
		<div style="float:left;margin-left:40px;">
		<form method="post" name="auth">
// This would be better done with a UNION query, I think, but MySQL doesn't
// support them yet. (NOTE you need MySQL 3.23 for temporary table support.)
$db->query("\r\n\t\tDROP TABLE IF EXISTS\r\n\t\t\thlstats_Frags_Kills\r\n\t");
$db->query("\r\n\t\tCREATE TEMPORARY TABLE\r\n\t\t\thlstats_Frags_Kills\r\n\t\t\t(\r\n\t\t\t\tplayerId INT(10),\r\n\t\t\t\tkills INT(10),\r\n\t\t\t\tdeaths INT(10),\r\n\t\t\t\theadshot INT(10),\r\n\t\t\t\tcountry varchar(128),\r\n\t\t\t\tflag char(2)\r\n\t\t\t)\r\n\t");
$db->query("\r\n\t\tINSERT INTO\r\n\t\t\thlstats_Frags_Kills\r\n\t\t\t(\r\n\t\t\t\tplayerId,\r\n\t\t\t\tkills,\r\n\t\t\t\theadshot\r\n\t\t\t)\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.victimId,\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Events_Frags.headshot\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tWHERE\r\n\t\t\thlstats_Events_Frags.killerId = {$player}\r\n\t\tGROUP BY\r\n\t\t\thlstats_Events_Frags.id\r\n\t");
$db->query("\r\n\t\tINSERT INTO\r\n\t\t\thlstats_Frags_Kills\r\n\t\t\t(\r\n\t\t\t\tplayerId,\r\n\t\t\t\tdeaths\r\n\t\t\t)\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Events_Frags.victimId\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tWHERE\r\n\t\t\thlstats_Events_Frags.victimId = {$player}\r\n\t");
$result = $db->query("\r\n\t\t\tSELECT\r\n\t\t\t\tSUM(hlstats_Frags_Kills.headshot) AS headshots\r\n\t\t\tFROM\r\n\t\t\t\thlstats_Frags_Kills\r\n\t\t\tGROUP BY\r\n\t\t\t\thlstats_Frags_Kills.playerId\r\n\t\t\tHAVING\r\n\t\t\t\tCOUNT(hlstats_Frags_Kills.kills) >= {$killLimit}\r\n\t");
$realheadshots = 0;
while ($rowdata = $db->fetch_array($result)) {
    $realheadshots += $rowdata['headshots'];
}
$db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players.lastName AS name\r\n\t\tFROM\r\n\t\t\thlstats_Frags_Kills,\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Frags_Kills.playerId = hlstats_Players.playerId\r\n\t\tGROUP BY\r\n\t\t\thlstats_Frags_Kills.playerId\r\n\t\tHAVING\r\n\t\t\tCOUNT(hlstats_Frags_Kills.kills) >= {$killLimit}\r\n\t");
$numitems = $db->num_rows();
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players.lastName AS name,\r\n\t\t\thlstats_Players.flag AS flag,\r\n\t\t\thlstats_Players.country AS country,\r\n\t\t\tCOUNT(hlstats_Frags_Kills.kills) AS kills,\r\n\t\t\tCOUNT(hlstats_Frags_Kills.deaths) AS deaths,\r\n\t\t\tROUND(COUNT(hlstats_Frags_Kills.kills) / {$realkills} * 100, 2) AS kpercent,\r\n\t\t\tROUND(COUNT(hlstats_Frags_Kills.deaths) / {$realdeaths} * 100, 2) AS dpercent,\r\n\t\t\thlstats_Frags_Kills.playerId AS victimId,\r\n\t\t\tROUND(COUNT(hlstats_Frags_Kills.kills) / IF(COUNT(hlstats_Frags_Kills.deaths) = 0, 1, COUNT(hlstats_Frags_Kills.deaths)), 2) AS kpd,\r\n\t\t\tSUM(hlstats_Frags_Kills.headshot = 1) AS headshots,\r\n\t\t\tROUND(SUM(hlstats_Frags_Kills.headshot = 1) / IF(COUNT(hlstats_Frags_Kills.kills) = 0, 1, COUNT(hlstats_Frags_Kills.kills)), 2) AS hpk,\r\n\t\t\tROUND(SUM(hlstats_Frags_Kills.headshot = 1) / {$realheadshots} * 100, 2) AS hpercent\r\n\t\tFROM\r\n\t\t\thlstats_Frags_Kills,\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Frags_Kills.playerId = hlstats_Players.playerId\r\n\t\tGROUP BY\r\n\t\t\thlstats_Frags_Kills.playerId\r\n\t\tHAVING\r\n\t\t\tCount(hlstats_Frags_Kills.kills) >= {$killLimit}\r\n\t\tORDER BY\r\n\t\t\t{$tblPlayerKillStats->sort} {$tblPlayerKillStats->sortorder},\r\n\t\t\t{$tblPlayerKillStats->sort2} {$tblPlayerKillStats->sortorder}\r\n\t\tLIMIT {$tblPlayerKillStats->startitem},{$tblPlayerKillStats->numperpage}\r\n\t");
if ($numitems > 0) {
    printSectionTitle('Player Kill Statistics *');
    $tblPlayerKillStats->draw($result, $numitems, 95);
    ?>
	<br /><br />
	<div class="subblock">
	<form method="get" action="<?php 
    echo $g_options['scripturl'];
    ?>
">
		<strong>&#8226;</strong> Show only victims this person has killed
		<select name="killLimit" onchange="Tabs.refreshTab({'killLimit': this.options[this.selectedIndex].value, 'playerkills_page': 1})">
			<?php 
    for ($j = 0; $j < 16; $j++) {
        echo "<option value=\"{$j}\"";
        if ($killLimit == $j) {
            echo ' selected="selected"';
$db->free_result();
pageHeader(array($gamename, 'Weapon Statistics'), array($gamename => "%s?game={$game}", 'Weapon Statistics' => ''));
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Weapons.code,\r\n\t\t\thlstats_Weapons.name\r\n\t\tFROM\r\n\t\t\thlstats_Weapons\r\n\t\tWHERE\r\n\t\t\thlstats_Weapons.game = '{$game}'\r\n\t");
while ($rowdata = $db->fetch_row($result)) {
    $code = $rowdata[0];
    $fname[$code] = $rowdata[1];
}
$tblWeapons = new Table(array(new TableColumn('weapon', 'Weapon', 'width=20&type=weaponimg&align=center&link=' . urlencode("mode=weaponinfo&amp;weapon=%k&amp;game={$game}"), $fname), new TableColumn('modifier', 'Modifier', 'width=8&align=right'), new TableColumn('kills', 'Kills', 'width=8&align=right'), new TableColumn('kpercent', '%', 'width=5&sort=no&align=right&append=' . urlencode('%')), new TableColumn('kpercent', 'Ratio', 'width=18&sort=no&type=bargraph'), new TableColumn('headshots', 'Headshots', 'width=8&align=right'), new TableColumn('hpercent', '%', 'width=5&sort=no&align=right&append=' . urlencode('%')), new TableColumn('hpercent', 'Ratio', 'width=18&sort=no&type=bargraph'), new TableColumn('hpk', 'HS:K', 'width=5&align=right')), 'weapon', 'kills', 'weapon', true, 9999, 'weap_page', 'weap_sort', 'weap_sortorder');
$db->query("\r\n\t\tSELECT\r\n\t\t\tIF(IFNULL(SUM(hlstats_Weapons.kills), 0) = 0, 1, SUM(hlstats_Weapons.kills)),\r\n\t\t\tIF(IFNULL(SUM(hlstats_Weapons.headshots), 0) = 0, 1, SUM(hlstats_Weapons.headshots))\r\n\t\tFROM\r\n\t\t\thlstats_Weapons\r\n\t\tWHERE\r\n\t\t\thlstats_Weapons.game = '{$game}'\r\n\t");
list($realkills, $realheadshots) = $db->fetch_row();
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Weapons.code AS weapon,\r\n\t\t\thlstats_Weapons.kills,\r\n\t\t\tROUND(hlstats_Weapons.kills / " . ($realkills == 0 ? 1 : $realkills) . " * 100, 2) AS kpercent,\r\n\t\t\thlstats_Weapons.headshots,\r\n\t\t\tROUND(hlstats_Weapons.headshots / IF(hlstats_Weapons.kills = 0, 1, hlstats_Weapons.kills), 2) AS hpk,\r\n\t\t\tROUND(hlstats_Weapons.headshots / " . ($realheadshots == 0 ? 1 : $realheadshots) . " * 100, 2) AS hpercent,\r\n\t\t\thlstats_Weapons.modifier\r\n\t\tFROM\r\n\t\t\thlstats_Weapons\r\n\t\tWHERE\r\n\t\t\thlstats_Weapons.game = '{$game}'\r\n\t\t\tAND hlstats_Weapons.kills > 0 \r\n\t\tGROUP BY\r\n\t\t\thlstats_Weapons.weaponId\r\n\t\tORDER BY\r\n\t\t\t{$tblWeapons->sort} {$tblWeapons->sortorder},\r\n\t\t\t{$tblWeapons->sort2} {$tblWeapons->sortorder}\r\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Weapon Statistics');
?>
	<div class="subblock">
		From a total of <strong><?php 
echo number_format($realkills);
?>
</strong> kills with <strong><?php 
echo number_format($realheadshots);
?>
</strong> headshots
	</div>
	<br /><br />
	<?php 
$tblWeapons->draw($result, $db->num_rows($result), 95);
?>
<br /><br />
foreach ($awards as $a) {
    if ($image = getImage("/games/{$game}/gawards/" . strtolower($a->aType . "_{$a->code}"))) {
        $image = $image['url'];
    } elseif ($image = getImage("/games/{$realgame}/gawards/" . strtolower($a->aType . "_{$a->code}"))) {
        $image = $image['url'];
    } else {
        $image = IMAGE_PATH . "/award.png";
    }
    $GlobalAwardsList .= "<img src=\"{$image}\" alt=\"{$a->ribbonName}\" title=\"{$a->ribbonName}\" /> ";
}
if ($ribbonList != '' || $GlobalAwardsList != '') {
    ?>

	<div style="clear:both;padding-top:24px;"></div>
	<?php 
    printSectionTitle('Awards (hover over image to see name)');
    ?>
	<div class="subblock">
		<div style="float:left;vertical-align:top;width:68.5%;">
			<table class="data-table">
				<tr class="data-table-head">
					<td>Ribbons</td>
				</tr>
				<tr class="bg1">
					<td style="text-align:center;"><?php 
    echo $ribbonList;
    ?>
</td>
				</tr>
			</table>
		</div>
if (isset($_GET['minkills'])) {
    $minkills = valid_request(intval($_GET['minkills']), 1);
} else {
    $minkills = 0;
}
pageHeader(array($gamename, 'Cheaters &amp; Banned Players'), array($gamename => "%s?game={$game}", 'Cheaters &amp; Banned Players' => ''));
$table = new Table(array(new TableColumn('lastName', 'Player', 'width=26&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('ban_date', 'Ban Date', 'width=15&align=right'), new TableColumn('skill', 'Points', 'width=6&align=right'), new TableColumn('activity', 'Activity', 'width=10&sort=no&type=bargraph'), new TableColumn('kills', 'Kills', 'width=5&align=right'), new TableColumn('deaths', 'Deaths', 'width=5&align=right'), new TableColumn('headshots', 'Headshots', 'width=7&align=right'), new TableColumn('kpd', 'K:D', 'width=10&align=right'), new TableColumn('hpk', 'HS:K', 'width=5&align=right'), new TableColumn('acc', 'Accuracy', 'width=6&align=right&append=' . urlencode('%'))), 'playerId', 'last_event', 'skill', true);
$day_interval = 28;
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*)\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.game = '{$game}'\r\n\t\t\tAND hlstats_Players.hideranking = 2\r\n\t\t\tAND hlstats_Players.kills >= {$minkills}\r\n\t");
list($numitems) = $db->fetch_row($resultCount);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players.playerId,\r\n\t\t\tFROM_UNIXTIME(last_event,'%Y.%m.%d %T') as ban_date,\r\n\t\t\thlstats_Players.flag,\r\n                        unhex(replace(hex(hlstats_Players.lastName), 'E280AE', '')) as lastName,\r\n\t\t\thlstats_Players.skill,\r\n\t\t\thlstats_Players.kills,\r\n\t\t\thlstats_Players.deaths,\r\n\t\t\tIFNULL(ROUND(hlstats_Players.kills / IF(hlstats_Players.deaths = 0, 1, hlstats_Players.deaths), 2), '-') AS kpd,\r\n\t\t\thlstats_Players.headshots,\r\n\t\t\tIFNULL(ROUND(hlstats_Players.headshots / hlstats_Players.kills, 2), '-') AS hpk,\r\n\t\t\tIFNULL(ROUND((hlstats_Players.hits / hlstats_Players.shots * 100), 0), 0) AS acc,\r\n\t\t\tactivity\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.game = '{$game}'\r\n\t\t\tAND hlstats_Players.hideranking = 2\r\n\t\t\tAND hlstats_Players.kills >= {$minkills}\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder},\r\n\t\t\thlstats_Players.lastName ASC\r\n\t\tLIMIT\r\n\t\t\t{$table->startitem},\r\n\t\t\t{$table->numperpage}\r\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Cheaters &amp; Banned Players');
?>
		<div class="subblock">
			<div style="float:left;">
				<form method="get" action="<?php 
echo $g_options['scripturl'];
?>
">
					<input type="hidden" name="mode" value="search" />
					<input type="hidden" name="game" value="<?php 
echo $game;
?>
" />
					<input type="hidden" name="st" value="player" />
					<strong>&#8226;</strong> Find a player:
					<input type="text" name="q" size="20" maxlength="64" class="textbox" />
For support and installation notes visit http://www.hlxcommunity.com
*/
if (!defined('IN_HLSTATS')) {
    die('Do not access this file directly.');
}
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\trankName,\r\n\t\t\tminKills,\r\n\t\t\trankId,\r\n\t\t\tcount(playerId) AS obj_count\r\n\t\tFROM\r\n\t\t\thlstats_Ranks\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Players\r\n\t\tON (\r\n           hlstats_Ranks.game=hlstats_Players.game\r\n           )\t\r\n\t\tWHERE\r\n\t\t\tkills>=minKills\r\n\t\t\tAND kills<=maxKills\r\n\t\t\tAND hlstats_Ranks.game='{$game}'\r\n\t\tGROUP BY\r\n\t\t\trankName,\r\n\t\t\tminKills\r\n\t");
while ($r = $db->fetch_array()) {
    $ranks[$r['rankId']] = $r['obj_count'];
}
// select the available ranks
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\trankName,\r\n\t\t\tminKills,\r\n\t\t\tmaxKills,\r\n\t\t\trankId,\r\n\t\t\timage\r\n\t\tFROM\r\n\t\t\thlstats_Ranks\r\n\t\tWHERE\r\n\t\t\thlstats_Ranks.game='{$game}'\t\r\n\t\tORDER BY\r\n\t\t\tminKills\r\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Ranks');
?>
	<div class="subblock">
		<table class="data-table">
<?php 
// draw the rank info table (5 columns)
$i = 0;
$cols = $g_options['awardrankscols'];
if ($cols < 1 || $cols > 10) {
    $cols = 5;
}
$colwidth = round(100 / $cols);
while ($r = $db->fetch_array()) {
    if ($i == $cols) {
        echo "</tr>";
        $i = 0;
			<tr class="data-table-head">
				<td colspan="3">Player Locations</td>
			</tr>
			<tr class="bg1">
				<td>
					<div id="map" style="margin:10px auto;width: 430px; height: 290px;"></div>
				</td>
			</tr>
		</table>
	</div>
</div><br />

<?php 
flush();
$tblMembers = new Table(array(new TableColumn('lastName', 'Name', 'width=32&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('skill', 'Points', 'width=6&align=right'), new TableColumn('activity', 'Activity', 'width=10&sort=no&type=bargraph'), new TableColumn('connection_time', 'Time', 'width=13&align=right&type=timestamp'), new TableColumn('kills', 'Kills', 'width=6&align=right'), new TableColumn('percent', 'Clan Kills', 'width=10&sort=no&type=bargraph'), new TableColumn('percent', '%', 'width=6&sort=no&align=right&append=' . urlencode('%')), new TableColumn('deaths', 'Deaths', 'width=6&align=right'), new TableColumn('kpd', 'Kpd', 'width=6&align=right')), 'playerId', 'skill', 'kpd', true, 20, 'members_page', 'members_sort', 'members_sortorder', 'members', 'desc', true);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Players.playerId,\r\n\t\t\thlstats_Players.lastName,\r\n\t\t\thlstats_Players.country,\r\n\t\t\thlstats_Players.flag,\r\n\t\t\thlstats_Players.skill,\r\n\t\t\thlstats_Players.connection_time,\r\n\t\t\thlstats_Players.kills,\r\n\t\t\thlstats_Players.deaths,\r\n\t\t\tROUND(hlstats_Players.kills / IF(hlstats_Players.deaths = 0, 1, hlstats_Players.deaths), 2) AS kpd,\r\n\t\t\tROUND(hlstats_Players.kills / IF(" . $clandata['kills'] . " = 0, 1, " . $clandata['kills'] . ") * 100, 2) AS percent,\r\n\t\t\tactivity\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.clan={$clan}\r\n\t\t\tAND hlstats_Players.hideranking = 0\r\n\t\tGROUP BY\r\n\t\t\thlstats_Players.playerId\r\n\t\tORDER BY\r\n\t\t\t{$tblMembers->sort} {$tblMembers->sortorder},\r\n\t\t\t{$tblMembers->sort2} {$tblMembers->sortorder},\r\n\t\t\thlstats_Players.skill DESC\r\n\t\tLIMIT {$tblMembers->startitem},{$tblMembers->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*)\r\n\t\tFROM\r\n\t\t\thlstats_Players\r\n\t\tWHERE\r\n\t\t\thlstats_Players.clan={$clan}\r\n\t\t\tAND hlstats_Players.hideranking = 0\r\n\t");
list($numitems) = $db->fetch_row($resultCount);
?>

<div style="clear:both;padding-top:20px;"></div>
<?php 
printSectionTitle('Members');
$tblMembers->draw($result, $numitems, 95);
?>
<br /><br />
<?php 
if ($g_options['show_google_map'] == 1) {
    include INCLUDE_PATH . '/google_maps.php';
    printMap('clan');
}
<?php

// VOICECOMM MODULE
global $db;
define('TS', 0);
define('VENT', 1);
define('TS3', 2);
$result = $db->query("\n\t\tSELECT\n\t\t\tserverId,\n\t\t\tname,\n\t\t\taddr,\n\t\t\tpassword,\n\t\t\tdescr,\n\t\t\tqueryPort,\n\t\t\tUDPPort,\n\t\t\tserverType\n\t\tFROM\n\t\t\thlstats_Servers_VoiceComm\n        ");
if ($db->num_rows($result) >= 1) {
    printSectionTitle('Voice Server');
    ?>
	<div class="subblock">
		<table class="data-table">
			<tr class="data-table-head">
				<td class="fSmall">Server Name</td>
				<td class="fSmall">Server Address</td>
				<td class="fSmall">Password</td>
				<td class="fSmall" style="text-align:right;">Channels</td>
				<td class="fSmall" style="text-align:right;">Slots&nbsp;used</td>
				<td class="fSmall">Notes</td>
			</tr> 
<?php 
    $i = 0;
    $j = 0;
    $t = 0;
    while ($row = $db->fetch_array()) {
        if ($row['serverType'] == TS) {
            $ts_servers[$i]['serverId'] = $row['serverId'];
            $ts_servers[$i]['name'] = $row['name'];
            $ts_servers[$i]['addr'] = $row['addr'];
            $ts_servers[$i]['password'] = $row['password'];
    $tblTeams->draw($result, $numitems, 95);
    ?>
	<br /><br />
<?php 
}
flush();
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Roles.code,\r\n\t\t\thlstats_Roles.name\r\n\t\tFROM\r\n\t\t\thlstats_Roles\r\n\t\tWHERE\r\n\t\t\thlstats_Roles.game = '{$game}'\r\n\t");
while ($rowdata = $db->fetch_row($result)) {
    $code = preg_replace("/[ \r\n\t]+/", "", $rowdata[0]);
    $fname[strToLower($code)] = htmlspecialchars($rowdata[1]);
}
$tblRoles = new Table(array(new TableColumn('code', 'Role', 'width=25&type=roleimg&align=left&link=' . urlencode("mode=rolesinfo&amp;role=%k&amp;game={$game}"), $fname), new TableColumn('rolecount', 'Joined', 'width=10&align=right&append=+times'), new TableColumn('percent', '%', 'width=10&sort=no&align=right&append=' . urlencode('%')), new TableColumn('percent', 'Ratio', 'width=20&sort=no&type=bargraph'), new TableColumn('killsTotal', 'Kills', 'width=10&align=right'), new TableColumn('deathsTotal', 'Deaths', 'width=10&align=right'), new TableColumn('kpd', 'K:D', 'width=10&align=right')), 'code', 'rolecount', 'name', true, 9999, 'roles_page', 'roles_sort', 'roles_sortorder', 'roles', 'desc', true);
$db->query("\r\n\t\tDROP TABLE IF EXISTS\r\n\t\t\thlstats_Frags_as\r\n\t");
$db->query("\r\n\t\tCREATE TEMPORARY TABLE\r\n\t\t\thlstats_Frags_as\r\n\t\t\t(\r\n\t\t\t\tplayerId INT(10),\r\n\t\t\t\tkills INT(10),\r\n\t\t\t\tdeaths INT(10),\r\n\t\t\t\trole varchar(128) NOT NULL default ''\r\n\t\t\t)\r\n\t");
$db->query("\r\n\t\tINSERT INTO\r\n\t\t\thlstats_Frags_as\r\n\t\t\t(\r\n\t\t\t\tplayerId,\r\n\t\t\t\tkills,\r\n\t\t\t\trole\r\n\t\t\t)\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.victimId,\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Events_Frags.killerRole\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tWHERE \r\n\t\t\thlstats_Events_Frags.killerId = {$player}\r\n\t");
$db->query("\r\n\t\tINSERT INTO\r\n\t\t\thlstats_Frags_as\r\n\t\t\t(\r\n\t\t\t\tplayerId,\r\n\t\t\t\tdeaths,\r\n\t\t\t\trole\r\n\t\t\t)\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Events_Frags.victimId,\r\n\t\t\thlstats_Events_Frags.victimRole\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tWHERE \r\n\t\t\thlstats_Events_Frags.victimId = {$player} \r\n\t");
$db->query("\r\n\t\tDROP TABLE IF EXISTS\r\n\t\t\thlstats_Frags_as_res\r\n\t");
$db->query("\r\n\t\tCREATE TEMPORARY TABLE\r\n\t\t\thlstats_Frags_as_res\r\n\t\t\t(\r\n\t\t\t\tkillsTotal INT(10),\r\n\t\t\t\tdeathsTotal INT(10),\r\n\t\t\t\trole varchar(128) NOT NULL default ''\r\n\t\t\t)\r\n\t");
$db->query("\r\n\t\tINSERT INTO\r\n\t\t\thlstats_Frags_as_res\r\n\t\t\t(\r\n\t\t\t\tkillsTotal,\r\n\t\t\t\tdeathsTotal,\r\n\t\t\t\trole\r\n\t\t\t)\r\n\t\tSELECT\r\n\t\t\tCOUNT(hlstats_Frags_as.kills) AS kills, \r\n\t\t\tCOUNT(hlstats_Frags_as.deaths) AS deaths,\r\n\t\t\thlstats_Frags_as.role\r\n\t\tFROM\r\n\t\t\thlstats_Frags_as\r\n\t\tGROUP BY\r\n\t\t\thlstats_Frags_as.role\r\n\t");
$db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(*)\r\n\t\tFROM\r\n\t\t\thlstats_Events_ChangeRole\r\n\t\tWHERE\r\n\t\t\thlstats_Events_ChangeRole.playerId = {$player}\r\n\t");
list($numrolejoins) = $db->fetch_row();
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\tIFNULL(hlstats_Roles.name, hlstats_Events_ChangeRole.role) AS name,\r\n\t\t\tIFNULL(hlstats_Roles.code, hlstats_Events_ChangeRole.role) AS code,\r\n\t\t\tCOUNT(hlstats_Events_ChangeRole.id) AS rolecount,\r\n\t\t\tROUND(COUNT(hlstats_Events_ChangeRole.id) / IF({$numrolejoins} = 0, 1, {$numrolejoins}) * 100, 2) AS percent,\r\n\t\t\thlstats_Frags_as_res.killsTotal,\r\n\t\t\thlstats_Frags_as_res.deathsTotal,\r\n\t\t\tROUND(hlstats_Frags_as_res.killsTotal / IF(hlstats_Frags_as_res.deathsTotal = 0, 1, hlstats_Frags_as_res.deathsTotal), 2) AS kpd\r\n\t\tFROM\r\n\t\t\thlstats_Events_ChangeRole\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Roles\r\n\t\tON\r\n\t\t\thlstats_Events_ChangeRole.role = hlstats_Roles.code\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Frags_as_res\r\n\t\tON\r\n\t\t\thlstats_Frags_as_res.role = hlstats_Events_ChangeRole.role\r\n\t\tWHERE\r\n\t\t\thlstats_Events_ChangeRole.playerId = {$player}\r\n\t\t\tAND\r\n\t\t\t(\r\n\t\t\t\thidden <> '1'\r\n\t\t\t\tOR hidden IS NULL\r\n\t\t\t)\r\n\t\t\tAND hlstats_Roles.game = '{$game}'\r\n\t\tGROUP BY\r\n\t\t\thlstats_Events_ChangeRole.role\r\n\t\tORDER BY\r\n\t\t\t{$tblRoles->sort} {$tblRoles->sortorder},\r\n\t\t\t{$tblRoles->sort2} {$tblRoles->sortorder}\r\n\t");
$numitems = $db->num_rows($result);
if ($numitems > 0) {
    printSectionTitle('Role Selection *');
    $tblRoles->draw($result, $numitems, 95);
    ?>
	<br /><br />

<?php 
}
    die('Do not access this file directly.');
}
// Daily Awards - WeaponImages und auch als Icondarstellung
$resultAwards = $db->query("\n\t\tSELECT\n\t\t\thlstats_Awards.awardId,\n\t\t\thlstats_Awards.awardType,\n\t\t\thlstats_Awards.code,\n\t\t\thlstats_Awards.name,\n\t\t\thlstats_Awards.verb,\n\t\t\thlstats_Awards.d_winner_id,\n\t\t\thlstats_Awards.d_winner_count,\n\t\t\thlstats_Players.lastName AS d_winner_name,\n\t\t\thlstats_Players.flag AS flag,\n\t\t\thlstats_Players.country AS country\n\t\tFROM\n\t\t\thlstats_Awards\n\t\tLEFT JOIN hlstats_Players ON\n\t\t\thlstats_Players.playerId = hlstats_Awards.d_winner_id\n\t\tWHERE\n\t\t\thlstats_Awards.game='{$game}'\n\t\tORDER BY\n\t\t\thlstats_Awards.name\n\t");
$result = $db->query("\n\t\tSELECT\n\t\t\tIFNULL(value, 1)\n\t\tFROM\n\t\t\thlstats_Options\n\t\tWHERE\n\t\t\tkeyname='awards_numdays'\n\t");
if ($db->num_rows($result) == 1) {
    list($awards_numdays) = $db->fetch_row($result);
} else {
    $awards_numdays = 1;
}
$result = $db->query("\n\t\tSELECT\n\t\t\tDATE_FORMAT(value, '%W %e %b'),\n\t\t\tDATE_FORMAT( DATE_SUB( value, INTERVAL {$awards_numdays} DAY ) , '%W %e %b' )\n\t\tFROM\n\t\t\thlstats_Options\n\t\tWHERE\n\t\t\tkeyname='awards_d_date'\n\t");
list($awards_d_date, $awards_s_date) = $db->fetch_row($result);
?>
<div class="block">
	<?php 
printSectionTitle(($awards_numdays == 1 ? 'Daily' : $awards_numdays . 'Day') . " Awards ({$awards_d_date})");
?>
	<div class="subblock">
		<table class="data-table">

<?php 
// draw the daily award info table (5 columns)
$i = 0;
$cols = $g_options['awarddailycols'];
if ($cols < 1 || $cols > 10) {
    $cols = 5;
}
$colwidth = round(100 / $cols);
while ($r = $db->fetch_array($resultAwards)) {
    if ($i == $cols) {
        echo '</tr>';
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

For support and installation notes visit http://www.hlxcommunity.com
*/
if (!defined('IN_HLSTATS')) {
    die('Do not access this file directly.');
}
// select the available ribbons
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Ribbons.ribbonId,\r\n\t\t\tribbonName,\r\n\t\t\timage,\r\n\t\t\tname as awardName,\r\n\t\t\tawardCount,\r\n\t\t\tcount(playerId) as achievedcount\r\n\t\tFROM\r\n\t\t\thlstats_Ribbons\t\r\n\t\tINNER JOIN\r\n\t\t\thlstats_Awards \r\n\t\tON (\r\n\t\t\tawardCode=code\r\n\t\t\tAND hlstats_Ribbons.game=hlstats_Awards.game\t\t\t    \r\n\t\t\t)\r\n\t\tLEFT JOIN\r\n\t\t\thlstats_Players_Ribbons\r\n\t\tON (\r\n\t\t\thlstats_Ribbons.ribbonId=hlstats_Players_Ribbons.ribbonId\r\n\t\t\t)\t    \r\n\t\tWHERE\r\n\t\t\thlstats_Ribbons.game='{$game}'\r\n\t\t\tAND hlstats_Ribbons.special=0\r\n\t\tGROUP BY\r\n\t\t\thlstats_Ribbons.ribbonId\r\n\t\tORDER BY\r\n\t\t\tawardCount,\r\n\t\t\tribbonName,\r\n\t\t\tawardCode\r\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Ribbons');
?>
	<div class="subblock">
		<table class="data-table">
<?php 
// draw the rank info table (5 columns)
$i = 0;
$i1 = 0;
$cnt = -1;
$cols = $g_options['awardribbonscols'];
if ($cols < 1 || $cols > 10) {
    $cols = 5;
}
$colwidth = round(100 / $cols);
while ($r = $db->fetch_array()) {
    if ($cnt != $r['awardCount']) {
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

For support and installation notes visit http://www.hlxcommunity.com
*/
if (!defined('IN_HLSTATS')) {
    die('Do not access this file directly.');
}
flush();
$tblMaps = new Table(array(new TableColumn('map', 'Map', 'width=22&align=left&link=' . urlencode("mode=mapinfo&amp;map=%k&amp;game={$game}")), new TableColumn('kills', 'Kills', 'width=7&align=right'), new TableColumn('kpercent', '%', 'width=6&sort=no&align=right&append=' . urlencode('%')), new TableColumn('kpercent', 'Ratio', 'width=8&sort=no&type=bargraph'), new TableColumn('deaths', 'Deaths', 'width=7&align=right'), new TableColumn('dpercent', '%', 'width=6&sort=no&align=right&append=' . urlencode('%')), new TableColumn('dpercent', 'Ratio', 'width=8&sort=no&type=bargraph'), new TableColumn('kpd', 'K:D', 'width=5&align=right'), new TableColumn('headshots', 'Headshots', 'width=7&align=right'), new TableColumn('hpercent', '%', 'width=6&sort=no&align=right&append=' . urlencode('%')), new TableColumn('hpercent', 'Ratio', 'width=8&sort=no&type=bargraph'), new TableColumn('hpk', 'HS:K', 'width=5&align=right')), 'map', 'kpd', 'kills', true, 9999, 'maps_page', 'maps_sort', 'maps_sortorder', 'tabmaps', 'desc', true);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\tIF(hlstats_Events_Frags.map='', '(Unaccounted)', hlstats_Events_Frags.map) AS map,\r\n\t\t\tSUM(hlstats_Events_Frags.killerId = {$player}) AS kills,\r\n\t\t\tSUM(hlstats_Events_Frags.victimId = {$player}) AS deaths,\r\n\t\t\tIFNULL(ROUND(SUM(hlstats_Events_Frags.killerId = {$player}) / IF(SUM(hlstats_Events_Frags.victimId = {$player}) = 0, 1, SUM(hlstats_Events_Frags.victimId = {$player})), 2), '-') AS kpd,\r\n\t\t\tROUND(CONCAT(SUM(hlstats_Events_Frags.killerId = {$player})) / {$realkills} * 100, 2) AS kpercent,\r\n\t\t\tROUND(CONCAT(SUM(hlstats_Events_Frags.victimId = {$player})) / {$realdeaths} * 100, 2) AS dpercent,\r\n\t\t\tSUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1) AS headshots,\r\n\t\t\tIFNULL(ROUND(SUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1) / SUM(hlstats_Events_Frags.killerId = {$player}), 2),'-') AS hpk,\r\n\t\t\tROUND(CONCAT(SUM(hlstats_Events_Frags.killerId = {$player} AND hlstats_Events_Frags.headshot = 1)) / {$realheadshots} * 100, 2) AS hpercent\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags\r\n\t\tWHERE\r\n\t\t\thlstats_Events_Frags.killerId = '{$player}'\r\n\t\t\tOR hlstats_Events_Frags.victimId = '{$player}'\r\n\t\tGROUP BY\r\n\t\t\thlstats_Events_Frags.map\r\n\t\tORDER BY\r\n\t\t\t{$tblMaps->sort} {$tblMaps->sortorder},\r\n\t\t\t{$tblMaps->sort2} {$tblMaps->sortorder}\r\n\t");
$numitems = $db->num_rows($result);
if ($numitems > 0) {
    ?>
<div style="clear:both;padding-top:20px;"></div>
<?php 
    printSectionTitle('Map Performance *');
    $tblMaps->draw($result, $numitems, 95);
    ?>
<br /><br />

<?php 
}
    function drawResults($link_player = -1, $link_clan = -1)
    {
        global $g_options, $db;
        if ($link_player == -1) {
            $link_player = "mode=playerinfo&amp;player=%k";
        }
        if ($link_clan == -1) {
            $link_clan = "mode=claninfo&amp;clan=%k";
        }
        ?>

</div class="block">
	<a name="results"></a>
	<?php 
        printSectionTitle('Search Results');
        ?>
	<br /><br />

<?php 
        $sr_query = preg_replace('/^STEAM_\\d+?\\:/i', '', $this->query);
        $sr_query = $db->escape($sr_query);
        $sr_query = preg_replace('/\\s/', '%', $sr_query);
        if ($this->type == 'player') {
            $table = new Table(array(new TableColumn('player_id', 'ID', 'width=5&align=right'), new TableColumn('name', 'Player', 'width=65&flag=1&link=' . urlencode($link_player)), new TableColumn('gamename', 'Game', 'width=30')), 'player_id', 'name', 'player_id', false, 50, 'page', 'sort', 'sortorder', 'results', 'asc');
            if ($this->game) {
                $andgame = "AND hlstats_Players.game='" . $this->game . "'";
            } else {
                $andgame = '';
            }
            $result = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\thlstats_PlayerNames.playerId AS player_id,\r\n\t\t\t\t\t\thlstats_PlayerNames.name,\r\n\t\t\t\t\t\thlstats_Players.flag,\r\n\t\t\t\t\t\thlstats_Players.country,\r\n\t\t\t\t\t\thlstats_Games.name AS gamename\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_PlayerNames\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = hlstats_PlayerNames.playerId\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_Players.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\tAND hlstats_PlayerNames.name LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\t\t\t\tLIMIT\r\n\t\t\t\t\t\t{$table->startitem},\r\n\t\t\t\t\t\t{$table->numperpage}\r\n\t\t\t\t");
            $resultCount = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_PlayerNames\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = hlstats_PlayerNames.playerId\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_Players.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\tAND hlstats_PlayerNames.name LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t");
            list($numitems) = $db->fetch_row($resultCount);
            $table->draw($result, $numitems, 95);
        } elseif ($this->type == 'uniqueid') {
            $table = new Table(array(new TableColumn('uniqueId', $this->uniqueid_string, 'width=15'), new TableColumn('lastName', 'Player', 'width=50&flag=1&link=' . urlencode($link_player)), new TableColumn('gamename', 'Game', 'width=30'), new TableColumn('playerId', 'ID', 'width=5&align=right')), 'playerId', 'lastName', 'uniqueId', false, 50, 'page', 'sort', 'sortorder', 'results', 'asc');
            if ($this->game) {
                $andgame = "AND hlstats_PlayerUniqueIds.game='" . $this->game . "'";
            } else {
                $andgame = '';
            }
            $result = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds.uniqueId,\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds.playerId,\r\n\t\t\t\t\t\thlstats_Players.lastName,\r\n\t\t\t\t\t\thlstats_Players.flag,\r\n\t\t\t\t\t\thlstats_Players.country,\r\n\t\t\t\t\t\thlstats_Games.name AS gamename\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = hlstats_PlayerUniqueIds.playerId\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_PlayerUniqueIds.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0' AND\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds.uniqueId LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\t\t\t\tLIMIT\r\n\t\t\t\t\t\t{$table->startitem},\r\n\t\t\t\t\t\t{$table->numperpage}\r\n\t\t\t\t");
            $resultCount = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = hlstats_PlayerUniqueIds.playerId\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_PlayerUniqueIds.uniqueId LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t");
            list($numitems) = $db->fetch_row($resultCount);
            $table->draw($result, $numitems, 95);
        } elseif ($this->type == 'ip') {
            if (!isset($_SESSION['loggedin']) || $_SESSION['acclevel'] < 80) {
                die("Access denied!");
            }
            $table = new Table(array(new TableColumn('player_id', 'ID', 'width=5&align=right'), new TableColumn('name', 'Player', 'width=65&flag=1&link=' . urlencode($link_player)), new TableColumn('gamename', 'Game', 'width=30')), 'player_id', 'name', 'player_id', false, 50, 'page', 'sort', 'sortorder', 'results', 'asc');
            if ($this->game) {
                $andgame = "AND hlstats_Players.game='" . $this->game . "'";
            } else {
                $andgame = '';
            }
            $result = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tconnects.playerId AS player_id,\r\n\t\t\t\t\t\thlstats_Players.lastname AS name,\r\n\t\t\t\t\t\thlstats_Players.flag,\r\n\t\t\t\t\t\thlstats_Players.country,\r\n\t\t\t\t\t\thlstats_Games.name AS gamename\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tplayerId,\r\n\t\t\t\t\t\t\t\tipAddress\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t`hlstats_Events_Connects`\r\n\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tplayerId,\r\n\t\t\t\t\t\t\t\tipAddress\r\n\t\t\t\t\t\t) AS connects\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = connects.playerId\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_Players.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\tAND connects.ipAddress LIKE '{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\t\t\t\tLIMIT\r\n\t\t\t\t\t\t{$table->startitem},\r\n\t\t\t\t\t\t{$table->numperpage}\r\n\t\t\t\t");
            $resultCount = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tplayerId,\r\n\t\t\t\t\t\t\t\tipAddress\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t`hlstats_Events_Connects`\r\n\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tplayerId,\r\n\t\t\t\t\t\t\t\tipAddress\r\n\t\t\t\t\t\t) AS connects\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Players\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Players.playerId = connects.playerId\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\thlstats_Games\r\n\t\t\t\t\tON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_Players.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\tAND connects.ipAddress LIKE '{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t");
            list($numitems) = $db->fetch_row($resultCount);
            $table->draw($result, $numitems, 95);
        } elseif ($this->type == 'clan') {
            $table = new Table(array(new TableColumn('tag', 'Tag', 'width=15'), new TableColumn('name', 'Name', 'width=50&icon=clan&link=' . urlencode($link_clan)), new TableColumn('gamename', 'Game', 'width=30'), new TableColumn('clanId', 'ID', 'width=5&align=right')), 'clanId', 'name', 'tag', false, 50, 'page', 'sort', 'sortorder', 'results', 'asc');
            if ($this->game) {
                $andgame = "AND hlstats_Clans.game='" . $this->game . "'";
            } else {
                $andgame = "";
            }
            $result = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\thlstats_Clans.clanId,\r\n\t\t\t\t\t\thlstats_Clans.tag,\r\n\t\t\t\t\t\thlstats_Clans.name,\r\n\t\t\t\t\t\thlstats_Games.name AS gamename\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_Clans\r\n\t\t\t\t\tLEFT JOIN hlstats_Games ON\r\n\t\t\t\t\t\thlstats_Games.code = hlstats_Clans.game\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Games.hidden = '0'\r\n\t\t\t\t\t\tAND (\r\n\t\t\t\t\t\t\thlstats_Clans.tag LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t\tOR hlstats_Clans.name LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\t\t\t\tLIMIT\r\n\t\t\t\t\t\t{$table->startitem},\r\n\t\t\t\t\t\t{$table->numperpage}\r\n\t\t\t\t");
            $resultCount = $db->query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tCOUNT(*)\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\thlstats_Clans\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\thlstats_Clans.tag LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\tOR hlstats_Clans.name LIKE '%{$sr_query}%'\r\n\t\t\t\t\t\t{$andgame}\r\n\t\t\t\t");
            list($numitems) = $db->fetch_row($resultCount);
            $table->draw($result, $numitems, 95);
        }
        ?>
	<br /><br />
	<div class="subblock" style="text-align:center;">
		Search results: <strong><?php 
        echo $numitems;
        ?>
</strong> items matching
	</div>
</div>
<?php 
    }
    error("No such game '{$game}'.");
}
list($gamename) = $db->fetch_row();
$db->free_result();
pageHeader(array($gamename, 'Server Chat Statistics'), array($gamename => "%s?game={$game}", 'Server Chat Statistics' => ''));
flush();
$servername = "(All Servers)";
if ($showserver != 0) {
    $result = $db->fetch_array($db->query("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\thlstats_Servers.name\r\n\t\t\t\tFROM\r\n\t\t\t\t\thlstats_Servers\r\n\t\t\t\tWHERE\r\n\t\t\t\t\thlstats_Servers.serverId = " . $db->escape($showserver) . "\r\n\t\t\t"));
    $servername = "(" . $result['name'] . ")";
}
?>

<div class="block">
	<?php 
printSectionTitle("{$gamename} {$servername} Server Chat Log (Last " . $g_options['DeleteDays'] . ' Days)');
?>
	<div class="subblock">
		<div style="float:left;">
			<span>
			<form method="get" action="<?php 
echo $g_options['scripturl'];
?>
" style="margin:0px;padding:0px;">
				<input type="hidden" name="mode" value="chat" />
				<input type="hidden" name="game" value="<?php 
echo $game;
?>
" />
				<strong>&#8226;</strong> Show Chat from
				<?php 
        echo sprintf("%.4f", 0);
    }
    ?>
</td>
		</tr>
	</table>        
<?php 
    printserverstats($server_id);
}
//for servers
?>
	</div>
</div>
<div class="block">
	<?php 
printSectionTitle('Server Load History');
?>
	<div class="subblock">
		<table class="data-table">
			<tr class="data-table-head">
				<td class="fSmall">&nbsp;24h View</td>
			</tr>
			<tr class="data-table-row">
				<td style="text-align:center; height: 200px; vertical-align:middle;">
					<img src="show_graph.php?type=0&amp;game=<?php 
echo $game;
?>
&amp;width=870&amp;height=200&amp;server_id=<?php 
echo $server_id;
?>
&amp;bgcolor=<?php 
$db->free_result();
pageHeader(array($gamename, 'Role Statistics'), array($gamename => "%s?game={$game}", 'Role Statistics' => ''));
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Roles.code,\r\n\t\t\thlstats_Roles.name\r\n\t\tFROM\r\n\t\t\thlstats_Roles\r\n\t\tWHERE\r\n\t\t\thlstats_Roles.game='{$game}'\r\n\t");
while ($rowdata = $db->fetch_row($result)) {
    $code = $rowdata[0];
    $fname[$code] = htmlspecialchars($rowdata[1]);
}
$tblRoles = new Table(array(new TableColumn('code', 'Role', 'width=24&type=roleimg&align=left&link=' . urlencode("mode=rolesinfo&amp;role=%k&amp;game={$game}"), $fname), new TableColumn('picked', 'Picked', 'width=9&align=right&append=+times'), new TableColumn('ppercent', '%', 'width=6&align=right&append=' . urlencode('%')), new TableColumn('ppercent', 'Ratio', 'width=9&sort=no&type=bargraph'), new TableColumn('kills', 'Kills', 'width=6&align=right'), new TableColumn('kpercent', '%', 'width=6&align=right&append=' . urlencode('%')), new TableColumn('kpercent', 'Ratio', 'width=9&sort=no&type=bargraph'), new TableColumn('deaths', 'Deaths', 'width=6&align=right'), new TableColumn('dpercent', '%', 'width=6&sort=no&align=right&append=' . urlencode('%')), new TableColumn('dpercent', 'Ratio', 'width=9&sort=no&type=bargraph'), new TableColumn('kpd', 'K:D', 'width=5&align=right')), 'code', 'kills', 'name', true, 9999, 'role_page', 'role_sort', 'role_sortorder');
$db->query("\r\n\t\tSELECT\r\n\t\t\tIF(IFNULL(SUM(hlstats_Roles.kills), 0) = 0, 1, SUM(hlstats_Roles.kills)),\r\n\t\t\tIF(IFNULL(SUM(hlstats_Roles.deaths), 0) = 0, 1, SUM(hlstats_Roles.deaths)),\r\n\t\t\tIF(IFNULL(SUM(hlstats_Roles.picked), 0) = 0, 1, SUM(hlstats_Roles.picked))\r\n\t\tFROM\r\n\t\t\thlstats_Roles\r\n\t\tWHERE\r\n\t\t\thlstats_Roles.game = '{$game}'\r\n\t\t\tAND hlstats_Roles.hidden = '0'\r\n\t");
list($realkills, $realdeaths, $realpicked) = $db->fetch_row();
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Roles.code,\r\n\t\t\thlstats_Roles.name,\r\n\t\t\thlstats_Roles.picked,\r\n\t\t\tROUND(hlstats_Roles.picked / {$realpicked} * 100, 2) AS ppercent,\r\n\t\t\thlstats_Roles.kills,\r\n\t\t\tROUND(hlstats_Roles.kills / {$realkills} * 100, 2) AS kpercent,\r\n\t\t\thlstats_Roles.deaths,\r\n\t\t\tROUND(hlstats_Roles.deaths / {$realdeaths} * 100, 2) AS dpercent,\r\n\t\t\tROUND(hlstats_Roles.kills / IF(hlstats_Roles.deaths = 0, 1, hlstats_Roles.deaths), 2) AS kpd\r\n\t\tFROM\r\n\t\t\thlstats_Roles\r\n\t\tWHERE\r\n\t\t\thlstats_Roles.game = '{$game}' \r\n\t\t\tAND hlstats_Roles.kills > 0 \r\n\t\t\tAND hlstats_Roles.hidden = '0'\r\n\t\tGROUP BY\r\n\t\t\thlstats_Roles.roleId\r\n\t\tORDER BY\r\n\t\t\t{$tblRoles->sort} {$tblRoles->sortorder},\r\n\t\t\t{$tblRoles->sort2} {$tblRoles->sortorder}\r\n\t");
?>

<div class="block">
	<?php 
printSectionTitle('Role Statistics');
?>
	<div class="subblock">
		From a total of <strong><?php 
echo number_format($realkills);
?>
</strong> kills with <strong><?php 
echo number_format($realdeaths);
?>
</strong> deaths
	</div>
	<br /><br />
	<?php 
$tblRoles->draw($result, $db->num_rows($result), 95);
?>
<br /><br />
$db->query("SELECT name FROM hlstats_Games WHERE code='{$game}'");
if ($db->num_rows() != 1) {
    error('Invalid or no game specified.');
} else {
    list($gamename) = $db->fetch_row();
}
pageHeader(array($gamename, 'Map Details', $map), array($gamename => $g_options['scripturl'] . "?game={$game}", 'Map Statistics' => $g_options['scripturl'] . "?mode=maps&game={$game}", 'Map Details' => ''), $map);
$table = new Table(array(new TableColumn('killerName', 'Player', 'width=50&align=left&flag=1&link=' . urlencode('mode=playerinfo&amp;player=%k')), new TableColumn('frags', "Kills on {$map}", 'width=25&align=right'), new TableColumn('headshots', 'Headshots', 'width=15&align=right'), new TableColumn('hpk', 'Hpk', 'width=5&align=right')), 'killerId', 'frags', 'killerName', true, 50);
$result = $db->query("\r\n\t\tSELECT\r\n\t\t\thlstats_Events_Frags.killerId,\r\n\t\t\thlstats_Players.lastName AS killerName,\r\n\t\t\thlstats_Players.flag as flag,\r\n\t\t\tCOUNT(hlstats_Events_Frags.map) AS frags,\r\n\t\t\tSUM(hlstats_Events_Frags.headshot=1) as headshots,\r\n\t\t\tIFNULL(SUM(hlstats_Events_Frags.headshot=1) / Count(hlstats_Events_Frags.map), '-') AS hpk\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags,\r\n\t\t\thlstats_Players\t\t\r\n\t\tWHERE\r\n\t\t\thlstats_Players.playerId = hlstats_Events_Frags.killerId\r\n\t\t\tAND hlstats_Events_Frags.map='{$map}'\r\n\t\t\tAND hlstats_Players.game='{$game}'\r\n\t\t\tAND hlstats_Players.hideranking<>'1'\r\n\t\tGROUP BY\r\n\t\t\thlstats_Events_Frags.killerId\r\n\t\tORDER BY\r\n\t\t\t{$table->sort} {$table->sortorder},\r\n\t\t\t{$table->sort2} {$table->sortorder}\r\n\t\tLIMIT {$table->startitem},{$table->numperpage}\r\n\t");
$resultCount = $db->query("\r\n\t\tSELECT\r\n\t\t\tCOUNT(DISTINCT hlstats_Events_Frags.killerId),\r\n\t\t\tSUM(hlstats_Events_Frags.map='{$map}')\r\n\t\tFROM\r\n\t\t\thlstats_Events_Frags,\r\n\t\t  hlstats_Servers\r\n\t\tWHERE\r\n\t\t\thlstats_Servers.serverId = hlstats_Events_Frags.serverId\r\n\t\t\tAND hlstats_Events_Frags.map='{$map}'\r\n\t\t\tAND hlstats_Servers.game='{$game}'\r\n\t");
list($numitems, $totalkills) = $db->fetch_row($resultCount);
?>

<div class="block">
	<?php 
printSectionTitle('Map Details');
?>
	<div class="subblock">
		<div style="float:left;">
			<strong><?php 
echo $map;
?>
</strong>: From a total of <strong><?php 
echo number_format(intval($totalkills));
?>
</strong> kills (Last <?php 
echo $g_options['DeleteDays'];
?>
 Days)
		</div>
		<div style="float:right;">