<?php
function routerDetect() {
$server = "0.0.0.0"; // Enter your IP address or website address.
$port = "80"; // Use port 80 if the $server variable has something running there.
$host = "Whatever"; // Call it what ever you want. It doesn't really matter.
preg_match("/^(http:\/\/)?([^\/]+)/i", "$server", $match);
$host = $match[2];
preg_match_all("/\.([^\.\/]+)/",$host, $match);
$matches[0][0] = $matches[1][0];
$host = trim($host);
$socket = "";
@$socket = fsockopen("$host", $port, $errno, $errstr, 2);
if(!$socket) {
$socket = header("Location: http://example.com/offline.png"); // Location of offline image goes here.
} else {
fclose($socket);
$socket = header("Location: http://example.com/online.png"); // Location of online image goes here.
}
}
routerDetect();
readfile($socket);
?>
(c) TeenDev 200? from GBAtemp.net
This woul;d be a useful feature on the page to tell you if 1. YOUR website is on (if logged in) and also
to tell people which box's are online.
If you do use it, please give credit to TeenDev