Merhabalar lai'nin gökhan abinin yazdığı kodlarla bir türlü uptime'yi çekemedim yaw biri bakarsa sevinecem.
<?php
$ip = 'serverip';
$port = 'serverport';
if ( @!$bag = fsockopen( $ip, $port, $num, $error, 5 ) ) {
$sonuc[0] = 0;
} else {
$sonuc[0] = 1;
fwrite( $bag, "\x7f\x00\x00\x01" );
fwrite( $bag, "\xf1\x00\x04\xff" );
$baglan = fgets( $bag );
preg_match( '/(Clients=)([0-9]{1,}),/', $baglan, $online );
$online[1] = $online[2] - 1;
echo $online[1];
fclose( $bag );
}
?>
tam kod ;
function sphereStatus($ip,$port) {
if ( @!$bag = fsockopen( $ip, $port, $num, $error, 5 ) ) {
$sonuc[0] = 0;
} else {
$sonuc[0] = 1;
fwrite($bag, "\x7f\x00\x00\x01");
fwrite($bag, "\xf1\x00\x04\xff");
$baglan = fgets( $bag );
preg_match('/(Clients=)([0-9]{1,}),/',$baglan, $online);
$online[1] = $online[2] - 1;
preg_match('/(Items=)([0-9]{1,}),/',$baglan,$items);
$items[1] = $items[2] -1;
preg_match('/(Chars=)([0-9]{1,}),/',$baglan,$chars);
$chars[1] = $chars[2] -1;
fclose( $bag );
return array("$online[1]","$items[1]","$chars[1]");
}
}
$sunucu1 = spherestatus('92.42.38.6','2593'); // runuo ipleri sitelerinde yazıyordu örnek olarak aldım
$sunucu2 = spherestatus('95.130.170.150','2593'); // runuo ipleri sitelerinde yazıyordu örnek olarak aldım
?>
<table border=1>
<tr>
<td>Sunucu İsmi</td>
<td>Online</td>
<td>Items</td>
<td>Chars</td>
</tr>
<tr>
<td>xxxxx server</td>
<td><?php echo "$sunucu1[0]"; ?></td>
<td><?php echo "$sunucu1[1]"; ?></td>
<td><?php echo "$sunucu1[2]"; ?></td>
</tr>
<tr>
<td>xxxxx server</td>
<td><?php echo "$sunucu2[0]"; ?></td>
<td><?php echo "$sunucu2[1]"; ?></td>
<td><?php echo "$sunucu2[2]"; ?></td>
</tr>
</table>
Timeup'u nasıl çekeriz, şimdiden teşekkürler..
Not : Lai sen baksan iyi olur