* add JSON masterserver server list, thanks statler!

This commit is contained in:
mnaumann 2011-07-17 21:31:26 +00:00
parent b215f88a29
commit 807a50b98b
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<?php
define( 'INCLUSION_PERMITTED', true );
require_once( 'config.php' );
require_once( 'functions.php' );
define( 'DB_LINK', db_connect() );
// consider replacing this by a cron job
cleanupServerList();
$servers_in_db = mysql_query( 'SELECT * FROM glestserver ORDER BY status, (networkSlots - connectedClients) DESC, lasttime DESC;' );
$all_servers = array();
while ( $server = mysql_fetch_array( $servers_in_db ) )
{
array_push( $all_servers, $server );
}
unset( $servers_in_db );
unset( $server );
db_disconnect( DB_LINK );
unset( $linkid );
echo json_encode($all_servers);
unset( $all_servers );
?>