<?
set_time_limit ( '20' );
error_reporting ( E_ERROR | E_PARSE );
$_ip = 'www.guia3d.com';
$_port = '7171';
$s = socket_create( AF_INET, SOCK_STREAM, getprotobyname ( 'tcp' ) );
if ( socket_connect ( $s, $_ip, $_port ) )
{
socket_send ( $s, chr(6).chr(0).chr(255).chr(255).'info', 8, 0 );
$a='';
$data='';
while ( socket_recv ( $s, $a, 1024, 0 ) )
$data.=$a;
socket_close( $s );
preg_match ( '#uptime="(.*?)".*?online="(.*?)" max="(.*?)"#', $data, $match );
if ( $match['1'] >= '60' )
{
$min = $match['1'] / 60;
if ( strstr ( $min, '.' ) )
{
$min2 = explode ( '.', $min );
$minuty = $min2['0'];
$sekundy = $match['1'] - $minuty * 60;
}
else
{
$minuty = $min;
}
if ( $minuty >= '60' )
{
$h = $minuty / 60;
if ( strstr ( $h, '.' ) )
{
$h2 = explode ( '.', $h );
$godziny = $h2['0'];
$minuty = $minuty - $godziny * 60;
}
else
{
$godziny = $h;
$minuty = '0';
}
$czas = $minuty.' m '.$sekundy.' s';
}
else
{
$godziny = '0';
}
}
else
{
$sekundy = $match['1'];
$godziny = 0;
$minuty = 0;
}
print 'Server is online<br/>Players: ('.$match['2'].'/'.$match['3'].')<br/>Uptime: '.$godziny.' h '.$minuty.' m '.$sekundy.' s';
}
else
{
print 'Server is offline';
}
?>
wenn ich bei mir auf php info schau seh ich nie das Sokcet Support da ist!
Users browsing this forum: No registered users and 46 guests