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>
<?php
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 );
$names[1] = substr($baglan, strpos($baglan,'=')+1, strpos($baglan,', Age=') - (strpos($baglan,'Name=')+5));
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("$names[1]","$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><?php echo "$sunucu1[0]"; ?></td>
<td><?php echo "$sunucu1[1]"; ?></td>
<td><?php echo "$sunucu1[2]"; ?></td>
<td><?php echo "$sunucu1[3]"; ?></td>
</tr>
<tr>
<td><?php echo "$sunucu2[0]"; ?></td>
<td><?php echo "$sunucu2[1]"; ?></td>
<td><?php echo "$sunucu2[2]"; ?></td>
<td><?php echo "$sunucu2[3]"; ?></td>
</tr>
</table>
Lai:
Cronjob -> Sunucu verilerini çekme scripti -> Veritabanına kayıt -> Veritabanından listeleme.