SA-MP Forums Archive
How To See If Server Is Online with HTML/JAVA/Whatever... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: How To See If Server Is Online with HTML/JAVA/Whatever... (/showthread.php?tid=83165)



How To See If Server Is Online with HTML/JAVA/Whatever... - CJ101 - 23.06.2009

ok i have a website set up (its drag and drop )

i dont kno shit about HTML or whatever it is.

so, i need something that can tell people if the server is online or not.

I just want text saying 'Server Is Online' or 'Server Is Offline'


Re: How To See If Server Is Online with HTML/JAVA/Whatever... - MachineHead - 23.06.2009

Take a look at http://www.azer.nl/samp.php.txt

I'm no PHP expert, but...

Code:
<?
	if (!isset($ip))
		$ip = 'yourip';
	if (!isset($port))
		$port = 7777;

	$fp = fsockopen('udp://' . $ip, $port, $errno, $errstr);
	if (!$fp)
	{
		echo "<tr><td bgcolor=\"#2B5486\">Server Offline</td></tr>\n";
	}
	else
	{
        echo "<tr><td bgcolor=\"#2B5486\">Server Online</td></tr>\n";
	}
		fclose($fp);
	}
?>
But as i said, i code with JSP, not PHP, so i could be totally wrong...