' . PHP_EOL; echo '' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . htmlspecialchars( PRODUCT_NAME ) . ' game stats' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo '

' . htmlspecialchars( PRODUCT_NAME ) . ' game stats

' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; // get stats for a specific game $gameUUID = ""; if ( isset( $_GET['gameUUID'] ) ) { $gameUUID = (string) clean_str( $_GET['gameUUID'] ); //printf( "Game UUID = %s\n", htmlspecialchars( $gameUUID, ENT_QUOTES ), PHP_EOL ); define( 'DB_LINK', db_connect() ); // consider replacing this by a cron job cleanupServerList(); $whereClause = 'gameUUID=\'' . mysql_real_escape_string( $gameUUID ) . '\''; $stats_in_db = mysql_query( 'SELECT * FROM glestgamestats WHERE ' . $whereClause . ';'); $all_stats = array(); while ( $stats = mysql_fetch_array( $stats_in_db ) ) { array_push( $all_stats, $stats ); } unset( $stats_in_db ); unset( $stats ); $player_stats_in_db = mysql_query( 'SELECT * FROM glestgameplayerstats WHERE ' . $whereClause . ' ORDER BY factionIndex;'); $all_player_stats = array(); while ( $player_stats = mysql_fetch_array( $player_stats_in_db ) ) { array_push( $all_player_stats, $player_stats ); } unset( $player_stats_in_db ); unset( $player_stats ); db_disconnect( DB_LINK ); unset( $linkid ); foreach( $all_stats as $stats ) { echo "\t\t\t" . '' . PHP_EOL; // Game Stats $gameDuration = $stats['framesToCalculatePlaytime']; $gameDuration = getTimeString($gameDuration); printf( "\t\t\t\t%s", htmlspecialchars( $gameDuration, ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $stats['maxConcurrentUnitCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $stats['totalEndGameConcurrentUnitCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $stats['isHeadlessServer'], ENT_QUOTES ), PHP_EOL ); echo "\t\t\t" . '' . PHP_EOL; // Player stats for Game echo "\t\t\t" . '' . PHP_EOL; echo '
Game DurationMaximum Concurrent UnitsTotal Units at EndHeadless Server
%s%s%s%s
' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; echo ' ' . PHP_EOL; foreach( $all_player_stats as $player_stats ) { echo "\t\t\t" . '' . PHP_EOL; printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['factionIndex'], ENT_QUOTES ), PHP_EOL ); $controlType = $player_stats['controlType']; switch ( $controlType ) { case 0: $controlTypeTitle = "Closed"; break; case 1: $controlTypeTitle = "CPU Easy"; break; case 2: $controlTypeTitle = "CPU"; break; case 3: $controlTypeTitle = "CPU Ultra"; break; case 4: $controlTypeTitle = "CPU Mega"; break; case 5: $controlTypeTitle = "Network Player"; break; case 6: $controlTypeTitle = "Network Unassigned"; break; case 7: $controlTypeTitle = "Human Host"; break; case 8: $controlTypeTitle = "Network CPU Easy"; break; case 9: $controlTypeTitle = "Network CPU"; break; case 10: $controlTypeTitle = "Network CPU Ultra"; break; case 11: $controlTypeTitle = "Network CPU Mega"; break; default: $controlTypeTitle = 'unknown'; } printf( "\t\t\t\t%s", htmlspecialchars( $controlTypeTitle, ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['resourceMultiplier'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['factionTypeName'], ENT_QUOTES ), PHP_EOL ); $personalityType = $player_stats['personalityType']; switch ( $personalityType ) { case 0: $personalityType = "Normal"; break; case 1: $personalityType = "Observer"; break; default: $personalityType = 'unknown'; } printf( "\t\t\t\t%s", htmlspecialchars( $personalityType, ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['teamIndex'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['wonGame'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['killCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['enemyKillCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['deathCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['unitsProducedCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['resourceHarvestedCount'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['playerName'], ENT_QUOTES ), PHP_EOL ); printf( "\t\t\t\t%s", htmlspecialchars( $player_stats['quitBeforeGameEnd'], ENT_QUOTES ), PHP_EOL ); $quitTime = $player_stats['quitTime']; $quitTime = getTimeString($quitTime); printf( "\t\t\t\t%s", htmlspecialchars( $quitTime, ENT_QUOTES ), PHP_EOL ); echo "\t\t\t" . '' . PHP_EOL; } unset( $all_player_stats ); unset( $player_stats ); } unset( $all_stats ); unset( $stats ); } echo '
Faction IndexPlayer TypeResource MultiplierFaction TypePersonality TypeTeamWinnerKillsEnemy KillsDeathsUnits ProducedResources HarvestedPlayer NameQuit Before Game EndedQuit Time
%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s
' . PHP_EOL; echo '

' . PHP_EOL; echo '
' . PHP_EOL; echo '

' . PHP_EOL; echo ' ' . PHP_EOL; echo '' . PHP_EOL; ?>