Log in

View Full Version : Status Script



jaffyy
08-05-2007, 09:29 PM
Hello everyone!

If someone know how i can make a GameServer/LoginServer Status shower script through Port and IP please tell me! :) or if there is already a such!

For Example:

GS(GameServer): Online (If the server is offline i want it to show Offline)
LS(LoginServer): Online (If the server is offline i want it to show Offline)

Thanks everyone in advance!!! :)

thetestingsite
08-05-2007, 09:40 PM
You could use many different techniques for this. One of the most frequently used methods is by using PHP's fsockopen() (http://www.php.net/fsockopen) function to try to connect to the server. This would look something like the following:



<?php
$GS = fsockopen("www.gameserver.com", 80, $errno, $errstr, 30);
$LS = fsockopen("www.loginServer.com", 80, $errno, $errstr, 30);

if (!$GS) { $GS_stat = 'Offline'; }
else { $GS_stat = 'Online'; }

if (!$LS) { $LS_stat = 'Offline'; }
else { $LS_stat = 'Online'; }
?>
Game Server Status: <?php echo $GS_stat;?> <br>
Login Server Status: <?php echo $LS_stat;?>


Hope this helps.

jaffyy
08-05-2007, 09:58 PM
I have one question. Can i use it on HTML? Or i can just recreate the HTML file into PHP and inser this code.

Well sorry but i dont know much for those languages! :)

jaffyy
08-05-2007, 10:15 PM
You could use many different techniques for this. One of the most frequently used methods is by using PHP's fsockopen() (http://www.php.net/fsockopen) function to try to connect to the server. This would look something like the following:



<?php
$GS = fsockopen("www.gameserver.com", 80, $errno, $errstr, 30);
$LS = fsockopen("www.loginServer.com", 80, $errno, $errstr, 30);

if (!$GS) { $GS_stat = 'Offline'; }
else { $GS_stat = 'Online'; }

if (!$LS) { $LS_stat = 'Offline'; }
else { $LS_stat = 'Online'; }
?>
Game Server Status: <?php echo $GS_stat;?> <br>
Login Server Status: <?php echo $LS_stat;?>


Hope this helps.

Okay i made it! Thanks very much for the help!!!! :) :)