Forum

> > Off Topic > php server info issue
Forums overviewOff Topic overviewLog in to reply

English php server info issue

4 replies
To the start Previous 1 Next To the start

old php server info issue

Ghost-Rider
BANNED Off Offline

Quote
Hi.. i downloaded ketamire php server query code..
and i edited a bit.. but have some issues.
when the server is online works without any problem but when offline.. at server information show the online text and the offline text too...
so the server is offline, however the online text too shows...
how can i fixt it..
here is the code:
Spoiler >
edited 1×, last 04.07.12 12:04:14 pm

old Re: php server info issue

ohaz
User Off Offline

Quote
1
2
3
4
if ($v_temp=="") {
     ?>
    <center><font color="red"><b>OFFLINE</b></font></center>
    <?php
}
else
{
1
2
3
4
5
6
?>
    <center><img src="cs2d.png" alt="cs2d icon" height="16" width="16" /><a href="cs2d://server1-cs2dh.co.cc:36963">Join</a></center>
    <center><font color="green"><b>ONLINE</b></font></center>
    <?php
     exit;
}
try this.

old Re: php server info issue

Ghost-Rider
BANNED Off Offline

Quote
i will try..
anyway one thing yet..
can i set the timeout?
because if someone browse my website
the server info too much loading....

old Re: php server info issue

Apache uwu
User Off Offline

Quote
Try setting the timeout lower:

1
2
3
4
5
6
//Step 3: Prepare the functions
function server_info($ip,$port) {
     $fp = @fsockopen("udp://".$ip, $port, $errno, $errstr,3);
     fwrite($fp, chr(1).chr(0).chr(251).chr(2));
     return fread($fp,2048);
}

Notice the 3 added to fsockopen, that indicates that the server will try to connect to the given IP, and if a response is not given within 3 seconds it will assume that it is offline.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview