Unsupported PHP app for analysing and displaying stats for Team Fortress 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?PHP
  2. require_once('inc/config.php');
  3. require_once('inc/mostmaps.php');
  4. require_once(STATS_DIR . '/inc/database.php');
  5. define('TITLE', 'Maps');
  6. require_once('inc/header.php');
  7. echo '<h2>Maps</h2>';
  8. echo '<div class="left">';
  9. echo '<h3>Most played</h3>';
  10. showMostMaps();
  11. echo '<h3 class="extra">Most kills per minute</h3>';
  12. showMostMapsSQL('SELECT map_name, (COUNT(*)/SUM(TIMESTAMPDIFF(MINUTE, game_starttime, game_endtime))) AS kills FROM maps NATURAL JOIN games NATURAL JOIN sessions NATURAL JOIN roleperiods INNER JOIN kills ON roleperiod_id = kill_killer WHERE session_endtime > \'0000-00-00\' GROUP BY map_name ORDER BY kills DESC LIMIT 0,3');
  13. echo '<h3 class="extra">Most recently played</h3>';
  14. showMostMapsSQL('SELECT map_name FROM maps NATURAL JOIN games ORDER BY game_endtime DESC LIMIT 0,3');
  15. echo '</div>';
  16. echo '<div class="right">';
  17. echo '<h3>Full map list</h3>';
  18. echo '<table>';
  19. echo '<tr><th>Map</th><th>Times Played</th><th>Average Session Length</th><th>Last Played</th></tr>';
  20. $sql = 'SELECT map_name, COUNT(*) AS times, AVG(TIMESTAMPDIFF(MINUTE, game_starttime, game_endtime)) AS length, MAX(UNIX_TIMESTAMP(game_endtime)) AS last FROM maps NATURAL JOIN games GROUP BY map_name ORDER BY map_name';
  21. $res = mysql_query($sql);
  22. $i = 0;
  23. while ($row = mysql_fetch_assoc($res)) {
  24. $i++;
  25. echo '<tr class="', ($i & 1 ? '' : 'even'), '">';
  26. echo '<td><a href="map.php?map=', htmlentities($row['map_name']), '">';
  27. echo htmlentities($row['map_name']), '</a></td>';
  28. echo '<td>', $row['times'], '</td>';
  29. echo '<td>', $row['length'], '</td>';
  30. echo '<td>', date('r', $row['last']), '</td>';
  31. echo '</tr>';
  32. }
  33. echo '</table>';
  34. echo '</div>';
  35. require_once('inc/footer.php');
  36. ?>