<?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 );
}
?>
Sunucu adi Online Rekor İtems Npcs Guilds
xxx 1 11 231 1 0
xxx 3 21 212 1 0
xxx 7 32 122 1 0
xxx 9 11 434 1 0
function spherestatus($ip, $port, $construction = false)
{
$telnet = @fsockopen($ip, $port, $errno, $errstr, 1);
if (!$telnet) {
echo '<b class="server1">Offline</b>';
} else {
@fputs ($telnet, '"');
$telnet_info = fgets($telnet, 4096);
if ($construction)
echo '<span class="server3">Bakım</span>';
else
echo '<b class="server2">Online</b>';
fclose($telnet);
return substr($telnet_info, (strpos($telnet_info, "Clients=", 0) + 8), (strpos($telnet_info, ", Items=", 0) - (strpos($telnet_info, "Clients=", 0) + 8)));
}
}
Sunucu ismi: <?php echo spherestatus(<ip>, <port>); ?>
Parse error: syntax error, unexpected T_STRING in /home/xxxx/public_html/Statusbilgileri.php on line 2
XXX UO <?php echo spherestatus(94.102.**.***, 2593); ?>
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, $construction = false)
{
$telnet = @fsockopen($ip, $port, $errno, $errstr, 1);
if (!$telnet) {
echo '<b class="server1">Offline</b>';
} else {
@fputs ($telnet, '"');
$telnet_info = fgets($telnet, 4096);
if ($construction)
echo '<span class="server3">Bakım</span>';
else
echo '<b class="server2">Online</b>';
fclose($telnet);
return substr($telnet_info, (strpos($telnet_info, "Clients=", 0) + 8), (strpos($telnet_info, ", Items=", 0) - (strpos($telnet_info, "Clients=", 0) + 8)));
}
}
?>
Sphere UO : <?php echo spherestatus('95.130.170.150', '2593'); ?>
Sunucu adi online items npcs guilds
xxx 1 1 1 1