| 
<?
 // ------------------------------------------------------------------------
 // BATTLEFIELD 2 - GAME SERVER QUERY CLASS
 // ------------------------------------------------------------------------
 // Written by: Bogdan Zarchievici <[email protected]>
 // Version: 5.0.1.a
 // Revision: Monday, February 06, 2006 at 5:10:15 PM
 // ------------------------------------------------------------------------
 // Comments: works with any PHP version greater than 4.1.0.
 // ------------------------------------------------------------------------
 // Special thanks to: Michael Damato, Brian Manning and all of you who have
 // been actively interested in the development of this class.
 // ------------------------------------------------------------------------
 // For more details on the Gamespy Query Format please visit:
 // http://forums.gametrack.org/viewtopic.php?t=311
 // http://dev.kquery.com/index.php?article=47
 // ------------------------------------------------------------------------
 
 error_reporting(E_ALL);
 ini_set("max_execution_time",5);
 
 function version($current,$required)
 { list($current[3],$current[2],$current[1])=split('[/.-]',$current);
 list($required[3],$required[2],$required[1])=split('[/.-]',$required);
 if ($current[3]>$required[3]) return true;
 if ($current[3]<$required[3]) return false;
 if ($current[2]>$required[2]) return true;
 if ($current[2]<$required[2]) return false;
 if ($current[1]>=$required[1]) return true;
 return true; }
 
 function call($class,$version)
 { if (version($version,"4.1.0")) { if (!include($class.'.php')) die('Please copy the PHP class in the current directory.'); }
 else { die('Current PHP version ['.$version.'] is too low for this class. You need PHP 4.1.0 or greater.'); }}
 
 call('battlefield-2-class',PHP_VERSION);
 $battlefield_2=&new battlefield_2($_GET['ip'],$_GET['port']);
 $status=get_object_vars($battlefield_2);
 
 include('templates/in-game.php');
 
 // 3 templates are currently available:
 // raw: displays the raw content returned by the PHP class;
 // classic: all the data returned by the class is nicely put into tables;
 // in-game: all the data is displayed much like in Battlefield 2. includes team stats.
 
 ?>
 |