From 93d98e3625db4f2591320820313f6a9958f73b67 Mon Sep 17 00:00:00 2001 From: titiger Date: Wed, 15 Jan 2014 01:48:41 +0100 Subject: [PATCH] first visible playerstats. + server list shows date of game instead of build date --- source/masterserver/showPlayers.php | 115 ++++++++++++++++++++++++++++ source/masterserver/showServers.php | 4 +- 2 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 source/masterserver/showPlayers.php diff --git a/source/masterserver/showPlayers.php b/source/masterserver/showPlayers.php new file mode 100644 index 00000000..0c33b3d8 --- /dev/null +++ b/source/masterserver/showPlayers.php @@ -0,0 +1,115 @@ += DATE_SUB(NOW(), INTERVAL 1 DAY) "; + } + else if( $period == "week") { + $timelimit = " and lasttime >= DATE_SUB(NOW(), INTERVAL 1 WEEK) "; + } + else if( $period == "month") { + $timelimit = " and 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' ); + $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; + + $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 ); + echo "\t\t\t" . '' . PHP_EOL; + } + echo '
'.htmlspecialchars('#').'Player NameGames Played
%s%s%s
' . PHP_EOL; + + //echo ' ' . PHP_EOL; + echo ' ' . PHP_EOL; + echo '' . PHP_EOL; + + unset( $all_players ); + unset( $player ); +?> diff --git a/source/masterserver/showServers.php b/source/masterserver/showServers.php index 49a0a315..b971c249 100644 --- a/source/masterserver/showServers.php +++ b/source/masterserver/showServers.php @@ -78,7 +78,7 @@ echo ' IPv4 address' . PHP_EOL; echo ' Game protocol port' . PHP_EOL; echo ' Platform' . PHP_EOL; - echo ' Build date' . PHP_EOL; + echo ' Play date' . PHP_EOL; echo ' ' . PHP_EOL; $games_with_stats = 0; @@ -185,7 +185,7 @@ printf( "\t\t\t\t%s%s", htmlspecialchars( $server['platform'], ENT_QUOTES ), PHP_EOL ); // binaryCompileDate - printf( "\t\t\t\t%s%s", htmlspecialchars( $server['binaryCompileDate'], ENT_QUOTES ), PHP_EOL ); + printf( "\t\t\t\t%s%s", htmlspecialchars( $server['lasttime'], ENT_QUOTES ), PHP_EOL ); echo "\t\t\t" . '' . PHP_EOL;