[PHP] Server Online/Offline Status
#1

Hi,
anyone can make me a simple php online/offline/passworded server status system for my server?
I try with samp_query.php but it still does not work.
Reply
#2

Feeling lazy so just gonna give you this first ****** result i got on "how to detect game server online php", http://stackoverflow.com/questions/2...y-that-on-my-w
Dont really see why you would want to password protect something like that, but you can find that via ****** too, your best route is most likely using .htaccess so look for that if you want to password protect a online/offline text
Reply
#3

Quote:
Originally Posted by Suicidal.Banana
Посмотреть сообщение
Feeling lazy so just gonna give you this first ****** result i got on "how to detect game server online php", http://stackoverflow.com/questions/2...y-that-on-my-w
Dont really see why you would want to password protect something like that, but you can find that via ****** too, your best route is most likely using .htaccess so look for that if you want to password protect a online/offline text
Код:
<?php
	
	$ip = "185.25.204.26";
	$port = "20510";
	
	function checkserveronline($ip, $port) {
    $fp = fsockopen($ip, $port, $errno, $errstr, 5);
    if(!$fp){
        return "offline";
    } else {
        return "online";
    }
}

echo "<img src='/images/" . checkserveronline($ip, 20510) . ".png' />";
It does not work.
Reply
#4

Quote:
Originally Posted by HaterSamp
Посмотреть сообщение
It does not work.
Nah, do it like this:

PHP код:
function checkserveronline($ip$port)
{
    return (!@
fsockopen("udp://".$ip$port$errno$errstr)) ? "<font color='red'>offline</font>" "<font color='green'>online</font>";
}
echo 
"Der Server ist: ".checkserveronline("185.25.204.26"20510); 
Reply
#5

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Nah, do it like this:

PHP код:
function checkserveronline($ip$port)
{
    return (!@
fsockopen("udp://".$ip$port$errno$errstr)) ? "<font color='red'>offline</font>" "<font color='green'>online</font>";
}
echo 
"Der Server ist: ".checkserveronline("185.25.204.26"20510); 
"Der Server ist: online" But the server is offline...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)