opentable('Serveris');
?>
<?php
//Serverio monitorius
if(!isset($ip)) $ip = "212.122.86.181";
if(!isset($port)) $port = 5555;
$fp = fsockopen('udp://' . $ip, $port, $errno, $errstr);
if($fp == TRUE)
{
$packet = "SAMP";
$packet .= chr(strtok($ip, '.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr(strtok('.'));
$packet .= chr($port & 0xFF);
$packet .= chr($port >> 8 & 0xFF);
fwrite($fp, $packet.'i');
fread($fp, 11);
$is_passworded = ord(fread($fp, 1));
$plr_count = ord(fread($fp, 2));
$max_plrs = ord(fread($fp, 2));
$strlen = ord(fread($fp, 4));
$hostname = fread($fp, $strlen);
$strlen = ord(fread($fp, 4));
$gamemode = fread($fp, $strlen);
$strlen = ord(fread($fp, 4));
$mapname = fread($fp, $strlen);
echo $hostname . '<br />';
echo 'IP: ' . $ip . '<br />';
echo 'Portas: ' . $port . '<br />';
echo 'Serveris: <span style='color: green'>Veikia</span><br />';
}
else
{
echo 'Nėra<br />';
echo 'IP: Nėra<br />';
echo 'Portas: Nėra<br />';
echo 'Serveris: <span style='color: green'>Neveikia</span><br />';
}
fclose($fp);
?>
<?
closetable();