Billybonga
IS-IT--Management
Hi
I'm working on a project at the moment for a captive portal for our wireless network (i.e. if someones IP address is not registered they get a Captive Portal Page). On the captive portal page I have two links which I want to show the status of (if they are alive/accessible or not) I am able to achieve this using the below php code (it checks the link and if active shows an ON button, else it shows an OFF button). Since the server we are running from does not support php, I have to look for alternative methods e.g. javascript, cgi
Can some-one help me?
function chkuri($link, $option)
{
if(substr($link,0,4)!="http"){
$link = " }
$timestart = microtime();
$churl = @fopen($link,'r');
$timeend = microtime();
$diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) - (substr($timestart,-10))),4);
$diff = $diff*100;
if (!$churl) {
$message="<img src=\" alt=\"OFFLINE\">";
}else{
$message="<img src=\" alt=\"ONLINE\">"; if($option==1){ $message = $message."[ ping: ".$diff."ms ]";}
}
echo $message;
}
?>
<?php chkuri(" ?>
I'm working on a project at the moment for a captive portal for our wireless network (i.e. if someones IP address is not registered they get a Captive Portal Page). On the captive portal page I have two links which I want to show the status of (if they are alive/accessible or not) I am able to achieve this using the below php code (it checks the link and if active shows an ON button, else it shows an OFF button). Since the server we are running from does not support php, I have to look for alternative methods e.g. javascript, cgi
Can some-one help me?
function chkuri($link, $option)
{
if(substr($link,0,4)!="http"){
$link = " }
$timestart = microtime();
$churl = @fopen($link,'r');
$timeend = microtime();
$diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) - (substr($timestart,-10))),4);
$diff = $diff*100;
if (!$churl) {
$message="<img src=\" alt=\"OFFLINE\">";
}else{
$message="<img src=\" alt=\"ONLINE\">"; if($option==1){ $message = $message."[ ping: ".$diff."ms ]";}
}
echo $message;
}
?>
<?php chkuri(" ?>