= DATE_SUB(NOW(), INTERVAL 1 DAY) "; } else if( $period == "week") { $timelimit = " and s.lasttime >= DATE_SUB(NOW(), INTERVAL 1 WEEK) "; } else if( $period == "month") { $timelimit = " and s.lasttime >= DATE_SUB(NOW(), INTERVAL 1 MONTH) "; } $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 ) ) { array_push( $all_players, $players ); } unset( $players_in_db ); unset( $players ); db_disconnect( DB_LINK ); unset( $linkid ); // Representation starts here header( 'Content-Type: text/html; charset=utf-8' ); echo '' . PHP_EOL; echo '' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . htmlspecialchars( PRODUCT_NAME ) . ' top 100 players' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo '

' . htmlspecialchars( PRODUCT_NAME ) . ' Top 100 Players

' . PHP_EOL; if( $period == "day") { echo ' ' . PHP_EOL; } echo ' ' . htmlspecialchars( 'day' ) . ' ' . PHP_EOL; if( $period == "day") { echo '' . PHP_EOL; } if( $period == "week") { echo ' ' . PHP_EOL; } echo ' ' . htmlspecialchars( 'week' ) . ' ' . PHP_EOL; if( $period == "week") { echo '' . PHP_EOL; } if( $period == "month") { echo ' ' . PHP_EOL; } echo ' ' . htmlspecialchars( 'month' ) . ' ' . PHP_EOL; if( $period == "month") { echo '' . PHP_EOL; } if( $period == "") { echo ' ' . PHP_EOL; } echo ' ' . htmlspecialchars( 'all time' ) . ' ' . PHP_EOL; if( $period == "") { echo '' . PHP_EOL; } echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; $position = 0; foreach( $all_players as $player ) { $position +=1; echo "\t\t\t" . '' . PHP_EOL; // # printf( "\t\t\t\t%s", htmlspecialchars( $position, ENT_QUOTES ), PHP_EOL ); // playername printf( "\t\t\t\t%s", htmlspecialchars( $player['playername'], ENT_QUOTES ), PHP_EOL ); // # of games games printf( "\t\t\t\t%s", htmlspecialchars( $player['c'], ENT_QUOTES ), PHP_EOL ); // # of games games printf( "\t\t\t\t%s", htmlspecialchars( $player['playtime'], ENT_QUOTES ), PHP_EOL ); echo "\t\t\t" . '' . PHP_EOL; } echo '
'.htmlspecialchars('#').'Player NameGames PlayedTotal Time Played
%s%s%s%s
' . PHP_EOL; //echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo '' . PHP_EOL; unset( $all_players ); unset( $player ); ?>