', "\n"; echo '', "\n"; echo 'RankAliasKillsDeathsKPDScore'; echo 'Mostly seen …', "\n"; echo '', $hideclass ? '' : 'Playing as', 'Killing with', "\n"; $sql = "SELECT players.player_id, player_rank, player_score, session_alias, SUM(roleperiod_kills) AS kills, SUM(roleperiod_deaths) AS deaths, SUM(roleperiod_kills)/SUM(roleperiod_deaths) AS kpd FROM players NATURAL JOIN sessions INNER JOIN roleperiods ON roleperiods.session_id = sessions.session_id $joins WHERE player_rank > 0 AND $where GROUP BY player_id ORDER BY " . (($where == '1=1' || $userank) ? 'player_rank' : 'kpd DESC') . " LIMIT $limit"; $res = mysql_query($sql) or print(mysql_error()); $i = 0; if (mysql_num_rows($res) == 0) { echo 'No results found'; } while ($row = mysql_fetch_assoc($res)) { if (!$hideclass) { $sql = "SELECT class_name, class_displayname FROM roleperiods NATURAL JOIN classes NATURAL JOIN sessions WHERE roleperiod_endtime > '0000-00-00' AND player_id = " . $row['player_id'] . " GROUP BY class_id ORDER BY SUM(roleperiod_endtime - roleperiod_starttime) DESC LIMIT 0,1"; $re2 = mysql_query($sql) or print(mysql_error()); } $sql = "SELECT weapon_name, COUNT(*) AS times FROM roleperiods INNER JOIN kills ON kills.kill_killer = roleperiod_id NATURAL JOIN weapons NATURAL JOIN sessions WHERE player_id = " .$row['player_id'] . " GROUP BY weapon_displayname ORDER BY times DESC LIMIT 0,1"; $re3 = mysql_query($sql) or print($sql . '
' . mysql_error()); $i++; $hclass = $row['player_id'] == $highlight ? 'highlight' : ''; if ($i % 2 == 0) { $class = ' class="even ' . $hclass . '"'; } else if ($hclass != '') { $class = ' class="' . $hclass . '"'; } else { $class = ''; } echo '', ($where == '1=1' || $userank) ? $row['player_rank'] : $i, ''; echo ''; if ($highlight != $row['player_id']) { echo ''; } echo htmlentities($row['session_alias'], ENT_COMPAT, 'UTF-8'); if ($highlight != $row['player_id']) { echo ''; } echo '', number_format($row['kills']), '', number_format($row['deaths']), ''; echo '', number_format($row['kpd'], 2), ''; echo '', number_format($row['player_score'], 0), ''; if (!$hideclass) { echo ''; echo ''; echo ''; } echo ''; if (mysql_num_rows($re3) > 0) { echo ''; } else { echo 'Nothing'; } echo ''; echo '', "\n"; } echo '', "\n"; }