showPlayers.php now with total time played
This commit is contained in:
parent
93d98e3625
commit
5606c45821
|
@ -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 ' <th title="position">'.htmlspecialchars('#').'</th>' . PHP_EOL;
|
||||
echo ' <th title="playerName">Player Name</th>' . PHP_EOL;
|
||||
echo ' <th title="gamesPlayed">Games Played</th>' . PHP_EOL;
|
||||
echo ' <th title="gamesPlayed">Total Time Played</th>' . PHP_EOL;
|
||||
echo ' </tr>' . PHP_EOL;
|
||||
|
||||
$position = 0;
|
||||
|
@ -102,6 +103,8 @@
|
|||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player['playername'], ENT_QUOTES ), PHP_EOL );
|
||||
// # of games games
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player['c'], ENT_QUOTES ), PHP_EOL );
|
||||
// # of games games
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player['playtime'], ENT_QUOTES ), PHP_EOL );
|
||||
echo "\t\t\t" . '</tr>' . PHP_EOL;
|
||||
}
|
||||
echo ' </table>' . PHP_EOL;
|
||||
|
|
Loading…
Reference in New Issue