<?php
/**********************************************************************

internet_state
author: Jose Mari Reyes
date  : 01-26-2017
        02-08-2017 port scanning

check if internet is active or not

sypnosis

192.168.32.1/cgi-bin/internet_state

return 1 for active connection and 0 if inactive connection

***********************************************************************/
$T = 5;


/*
 *
 * Commented/ disabled
while (1 == 1)
{
        is_active();
        sleep($T);
}

function is_active()
{

        $res = shell_exec("nc -n -v -z 93.157.3.167 10990 -w 10 2>&1");
        $v = 0;
        if (strpos($res, "open") !== false) $v = "1";
        file_put_contents("/tmp/internet.state", $v);
}
*/
?>

