include_once('config.inc.php');
//Server IP & Port, Used if no Server IP and Port is used in the URL
//Default Query Port is 29900 leave as is, if your server does not show up
//you can try increasing the Port by 1 or check the value of sv.gameSpyPort in your
//serversettings.con file.
$server = $GAMESERVER;
$port = $GAMEPORT;
$refreshrate = '600';
$sort = 'score';
// Здесь можно указать порт для вывода монитора для второго сервера. Пример: http://mgm.by/bf2/monitor.php
// Чтобы включить вывод монитора для 2-го сервера - см. строку 781 этого файла
$port2 = "29901";
function monitor ($port) {
GLOBAL $sort, $refreshrate, $server, $GAMESERVER, $GAMEPORT, $ROOT;
//URL to Images folder. No trailing slash.
$images = $ROOT;
//Border Color of the Stats
$bordercolor = '#000000';
//Body Color of inside the stats table
$bodycolor = '#5C5F52';
//Top and Bottom Cell Colors
$topbottomcell = '#383C33';
//Page Background Color
$backgroundcolor = '#3C3A36';
//Server Admin Name, will show as red on the playerlist, or Use serveradmintag to highlight
//anyone with that tag, must escape regexp chars ([,.{( and so on)
$serveradmin = 'Admin';
$serveradmintag = 'ADM';
//Default Sort. Can be 'deaths', 'score', 'kills', or 'ping'
$sort = 'score';
//Page Refresh Rate in Seconds
$refreshrate = '600';
//Font Color
$fontcolor = '#FFFFFF';
//Number of Ping to be know as a Lagger, Anything above this number will be marked
$lagger = '120';
//Insert Image URL if using your own Logo in the stats, or leave blank if not. Do not make your image wider than 800
//pixels or it will make the table look funny :)
$titlepic = '';
//If Using your own logo, specify alignment (left, center, right)
$align = 'left';
//If Using your own logo, specify color behind your Logo
$titlepicbg = '#BAB3A1';
//Colors for Laggers, Admin, and Teamkiller
$laggercolor = '#999999';
$admincolor = '#CC6600';
$teamkillercolor = '#E4FF4D';
//Colors for Player Count if Server is Full or if Server has an Open Slot
$servernotfullcolor = 'yellow';
$serverfullcolor = '#FB0A04';
//Comments that you may want to add on your Live View for people to read.
//Will show up under the Rules Section
//Set $usecomments to 1 for On and 0 for Off
$usecomments = '0';
$comments = 'Comments that you may want to add on your Live View for people to read';
//Mark 1 to display your Community Logo, and 1 to display your Sponsor Logo
$community_logo = '1';
$sponsor_logo = '0';
//Message to display when server times out or is down
$timeoutmessage = 'Сервер не работает или идет смена карты';
if (!$_GET['sort'])
{
$sort=$sort;
} else {
$sort=$_GET['sort'];
}
if (!$_GET['ip']) {
$server=$server;
} else {
$server=$_GET['ip'];
}
if (!$_GET['port']) {
$port=$port;
} else {
$port=$_GET['port'];
}
$sock = @fsockopen("udp://".$server, $port);
@socket_set_timeout($sock, 0, 800000);
$queryString = "\xFE\xFD\x00\x10\x20\x30\x40\xFF\xFF\xFF\x01";
@fwrite($sock, $queryString);
$end=false;
$i=1;
while(!$end) {
$bytes = @fread($sock, 1);
$status = @socket_get_status($sock);
$length = $status['unread_bytes'];
if($length>0) {
$Info[$i] = $bytes.fread($sock, $length);
preg_match("/splitnum(...)/is",$Info[$i],$regs);
$String = $regs[1];
$num = ord(substr($String,1,1));
if($num == 128 || $num == 0) {
$Display[1] = $Info[$i];
}
if ($num == 129 || $num == 1) {
$Display[2] = $Info[$i];
}
if ($num == 130) {
$Display[3] = $Info[$i];
}
}
if($length==0) {
$end=true;
}
$i++;
}
@fclose($sock);
$Info = $Display[1].$Display[2].$Display[3];
if(!$Info) {
?>