Ragnarok Online > General Discussion

Server Status for Website - Need help

(1/1)

lacroserocks:
Ive looked all over the internet for a simple script to show the server status on my PHP-Nuke website ( http://here2obliterate.com ).

I found one that works pretty good but I had to do some major editing to the script in order to show all 3 servers ( login, char, and map ).

I got it working and it worked like a charm. But now for some reason, it keeps showing that the servers are offline even though I can get on the server. I have checked the port forwarding, refreshed page, closed browser and reloaded page with both IE and Firefox, but it still shows that its offline.

Does anyone know how to fix it or have any suggestions for a better one that works?

Also, ratemyserver.net has a server status and it works for my server showing that its Online. Is it possible for me to get that script/files?


Heres what im using right now that doesnt work anymore:

--- Code: ---<?php
$live = "live.gif";
$dead = "dead.gif";
$link = $_GET['link'].":";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
if (empty($port)){
$port = 6900;
}
$churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
             if (!$churl){
 //echo $errstr;
                header("Location: $dead");
                }
             else {
                header("Location: $live");             
  }
function server($addr){
         if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
         return $addr;
}
?>

--- End code ---

And i have 3 versions of this file ( one for each port ) on my website.

Then I use this HTML code to show it:

--- Code: ---<tr>
    <td><font>Login</font></td>
    <td><img src="login_status.php?link=66.57.29.197"></td>
</tr>

--- End code ---

And I have 2 more using the 3 different files: login_status.php , char_status.php , map_status.php

And I have 2 pictures (red and green poring) showing that its online or ofline.

It used to work but now it doesnt.

So can anyone get me a script that works better or tell me how to fix this?

yC:
I took out few things that I found can be ignored and came up with this simplier version:


--- Code: ---<?php
$live = "live.gif";
$dead = "dead.gif";
$link = $_GET['link'];

if (empty($port)){
$port = 6900;
}
$churl = @fsockopen($link, $port, $errno, $errstr, 5);
 
if (!$churl){
    header("Location: $dead");
}else {
    header("Location: $live");             
}

?>

--- End code ---

it should work, u can just try it with:

login_status.php?link=66.57.29.197

without the port parameter, it will use the default port 6900, if u need to check other ports u use:

login_status.php?link=66.57.29.197&port=6121
login_status.php?link=66.57.29.197&port=5121
...etc

i also recommend a lower time for timeout,
"$churl = @fsockopen($link, $port, $errno, $errstr, 5);" 
that 5 there is how long should the script give up trying to connect, u had 20 seconds which means if server is down it will take 20 seconds for it to show the status...well that's a preference you might want to change to whatever you like.

The reason that your script stopped working...could it be you have a different format of IP or URL in the link= parameter than u used to have?  Because it looks like your script is designed to handle URL instead of a simple IP address.  Since you have a simple IP address, you don't need all the other fancy stuff.

lacroserocks:
well i dont know what happened but i hadnt changed anything. I went away for a 10 day vacation and came back to find it not working.

but ill try your way. Thanks.

Navigation

[0] Message Index

Go to full version