From 5606c458214a2603270be36c6b06946114c92cab Mon Sep 17 00:00:00 2001 From: titiger Date: Thu, 16 Jan 2014 01:40:28 +0100 Subject: [PATCH] showPlayers.php now with total time played --- source/masterserver/showPlayers.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/masterserver/showPlayers.php b/source/masterserver/showPlayers.php index 0c33b3d8..deaa6326 100644 --- a/source/masterserver/showPlayers.php +++ b/source/masterserver/showPlayers.php @@ -18,16 +18,16 @@ $timelimit=" "; if( $period == "day") { - $timelimit = " and lasttime >= DATE_SUB(NOW(), INTERVAL 1 DAY) "; + $timelimit = " and s.lasttime >= DATE_SUB(NOW(), INTERVAL 1 DAY) "; } else if( $period == "week") { - $timelimit = " and lasttime >= DATE_SUB(NOW(), INTERVAL 1 WEEK) "; + $timelimit = " and s.lasttime >= DATE_SUB(NOW(), INTERVAL 1 WEEK) "; } else if( $period == "month") { - $timelimit = " and lasttime >= DATE_SUB(NOW(), INTERVAL 1 MONTH) "; + $timelimit = " and s.lasttime >= DATE_SUB(NOW(), INTERVAL 1 MONTH) "; } - $players_in_db = mysql_query( 'select playername, count(*) as c from glestgameplayerstats s where controltype>4 '.$timelimit.' group by playername having c >1 order by c desc,playername LIMIT 100' ); + $players_in_db = mysql_query( 'select playername, count(*) as c, SEC_TO_TIME(sum(ggs.framesToCalculatePlaytime)/30) as playtime from glestgameplayerstats s , glestgamestats ggs where s.gameUUID=ggs.gameUUID and controltype>4 '.$timelimit.' group by playername having c >1 order by c desc,playername LIMIT 100' ); $all_players = array(); while ( $players = mysql_fetch_array( $players_in_db ) ) { @@ -89,6 +89,7 @@ echo ' '.htmlspecialchars('#').'' . PHP_EOL; echo ' Player Name' . PHP_EOL; echo ' Games Played' . PHP_EOL; + echo ' Total Time Played' . PHP_EOL; echo ' ' . PHP_EOL; $position = 0; @@ -102,6 +103,8 @@ printf( "\t\t\t\t%s%s", htmlspecialchars( $player['playername'], ENT_QUOTES ), PHP_EOL ); // # of games games printf( "\t\t\t\t%s%s", htmlspecialchars( $player['c'], ENT_QUOTES ), PHP_EOL ); + // # of games games + printf( "\t\t\t\t%s%s", htmlspecialchars( $player['playtime'], ENT_QUOTES ), PHP_EOL ); echo "\t\t\t" . '' . PHP_EOL; } echo ' ' . PHP_EOL;