I created this small PHP script to show online status of my various game, minecraft, etc.. servers. The PHP script is easy, the only sucky part is that there are quite a few webhosts that prevent PHP from using the port functions.
Here's the code you'd use. It has a 5 second timeout. Use the below link as a direct image.
Which will produce the following.
IP = 209.159.212.203 : Port = 25566
Here's the PHP code.
Here's the code you'd use. It has a 5 second timeout. Use the below link as a direct image.
Code:
[url=http://decisive-media.net/server.php?host=your_ip_here&port=your_port_here]http://decisive-media.net/server.php?ho ... _port_here[/url]
IP = 209.159.212.203 : Port = 25566
Here's the PHP code.
PHP:
<div class="php" id="{CB}" style="font-family: monospace;"><ol><span style="color: #000000; font-weight: bold;"><?php
[url=http://www.php.net/header]header[/url]("Content-Type: image/png");
$im = @[url=http://www.php.net/imagecreate]imagecreate[/url](<span style="color: #cc66cc;">70, <span style="color: #cc66cc;">20) or die("Cannot Initialize new GD image stream");
$site = $_GET['host'];
$port = $_GET['port'];
$background_color = [url=http://www.php.net/imagecolorallocate]imagecolorallocate[/url]($im, <span style="color: #cc66cc;">0, <span style="color: #cc66cc;">0, <span style="color: #cc66cc;">0);
$online = [url=http://www.php.net/imagecolorallocate]imagecolorallocate[/url]($im, <span style="color: #cc66cc;">0, <span style="color: #cc66cc;">255, <span style="color: #cc66cc;">0);
$offline = [url=http://www.php.net/imagecolorallocate]imagecolorallocate[/url]($im, <span style="color: #cc66cc;">255, <span style="color: #cc66cc;">0, <span style="color: #cc66cc;">0);
$fp = [url=http://www.php.net/fsockopen]fsockopen[/url]($site,$port,$errno,$errstr,<span style="color: #cc66cc;">5);
[url=http://www.php.net/if]<span style="color: #b1b100;">if[/url](!$fp)
[url=http://www.php.net/imagestring]imagestring[/url]($im, <span style="color: #cc66cc;">5, <span style="color: #cc66cc;">5, <span style="color: #cc66cc;">5, "Offline", $offline);
[url=http://www.php.net/else]<span style="color: #b1b100;">else[/url]{
[url=http://www.php.net/imagestring]imagestring[/url]($im, <span style="color: #cc66cc;">5, <span style="color: #cc66cc;">5, <span style="color: #cc66cc;">5, "Online", $online);
[url=http://www.php.net/fclose]fclose[/url]($fp);
}
[url=http://www.php.net/imagepng]imagepng[/url]($im);
[url=http://www.php.net/imagedestroy]imagedestroy[/url]($im);
<span style="color: #000000; font-weight: bold;">?>