changed default from last 8 hours toi last 48 hours of games
This commit is contained in:
parent
ed4444a6da
commit
1fd4f6540a
|
@ -19,6 +19,9 @@
|
|||
// http://php.net/manual/features.persistent-connections.php
|
||||
define( 'MYSQL_LINK_PERSIST', false );
|
||||
|
||||
// Show games in the games list no older than x hours
|
||||
define( 'MAX_HOURS_OLD_GAMES', 48 );
|
||||
|
||||
// How many recently seen servers to store
|
||||
define( 'MAX_RECENT_SERVERS', 5 );
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ function setupGameStatsLink(gameIndex) {
|
|||
var link = document.getElementById('gameStats_' + gameIndex);
|
||||
link.onclick = function() {
|
||||
var row = document.getElementById('content_row_' + this.getAttribute('gameuuid'));
|
||||
if(row && row.className == 'fullyhide') {
|
||||
//if(row && row.className == 'fullyhide') {
|
||||
if(row) {
|
||||
row.className = 'fullyshow';
|
||||
row.innerHTML = '<td width=\'100%\' colspan=\'100\'><a id=\'hide_stats_' + this.getAttribute('gameuuid') + '\' href=\'#\'>Hide Stats</a><div width=\'100%\' id=\'content_' + this.getAttribute('gameuuid') + '\'></div></td>';
|
||||
|
||||
|
|
|
@ -103,11 +103,27 @@
|
|||
echo ' </tr>' . PHP_EOL;
|
||||
|
||||
$best_score = 0;
|
||||
$best_score_enemyKillCount = 0;
|
||||
$best_score_unitsProducedCount = 0;
|
||||
$best_score_resourceHarvestedCount = 0;
|
||||
foreach( $all_player_stats as $player_stats )
|
||||
{
|
||||
if($best_score_enemyKillCount < $player_stats['enemyKillCount'])
|
||||
{
|
||||
$best_score_enemyKillCount = $player_stats['enemyKillCount'];
|
||||
}
|
||||
if($best_score_unitsProducedCount < $player_stats['unitsProducedCount'])
|
||||
{
|
||||
$best_score_unitsProducedCount = $player_stats['unitsProducedCount'];
|
||||
}
|
||||
if($best_score_resourceHarvestedCount < $player_stats['resourceHarvestedCount'])
|
||||
{
|
||||
$best_score_resourceHarvestedCount = $player_stats['resourceHarvestedCount'];
|
||||
}
|
||||
|
||||
$player_score = $player_stats['enemyKillCount'] * 100 + $player_stats['unitsProducedCount'] * 50 + $player_stats['resourceHarvestedCount'] / 10;
|
||||
|
||||
if($best_score < $player_score)
|
||||
if($best_score < $player_score)
|
||||
{
|
||||
$best_score = $player_score;
|
||||
}
|
||||
|
@ -176,10 +192,31 @@
|
|||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $wonGame_class, htmlspecialchars( $player_stats['wonGame'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['killCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['enemyKillCount'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score_class = "player_losing_score";
|
||||
if($best_score_enemyKillCount == $player_stats['enemyKillCount'])
|
||||
{
|
||||
$player_score_class = "player_high_score";
|
||||
}
|
||||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $player_score_class, htmlspecialchars( $player_stats['enemyKillCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['deathCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['unitsProducedCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['resourceHarvestedCount'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score_class = "player_losing_score";
|
||||
if($best_score_unitsProducedCount == $player_stats['unitsProducedCount'])
|
||||
{
|
||||
$player_score_class = "player_high_score";
|
||||
}
|
||||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $player_score_class, htmlspecialchars( $player_stats['unitsProducedCount'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score_class = "player_losing_score";
|
||||
if($best_score_resourceHarvestedCount == $player_stats['resourceHarvestedCount'])
|
||||
{
|
||||
$player_score_class = "player_high_score";
|
||||
}
|
||||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $player_score_class, htmlspecialchars( $player_stats['resourceHarvestedCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['playerName'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score = $player_stats['enemyKillCount'] * 100 + $player_stats['unitsProducedCount'] * 50 + $player_stats['resourceHarvestedCount'] / 10;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
// consider replacing this by a cron job
|
||||
cleanupServerList();
|
||||
|
||||
$servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' );
|
||||
$servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients) , ip DESC;' );
|
||||
$all_servers = array();
|
||||
while ( $server = mysql_fetch_array( $servers_in_db ) )
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// consider replacing this by a cron job
|
||||
cleanupServerList();
|
||||
|
||||
$servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
|
||||
$servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL - ' . MAX_HOURS_OLD_GAMES . ' hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
|
||||
$all_servers = array();
|
||||
while ( $server = mysql_fetch_array( $servers_in_db ) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue