Location: PHPKode > projects > WaveWatcher > wavewatcher3/html/ww_uptime.php
<?
//-----------------------------------------------------------
//ww_uptime.php  - Made by Rasmus Melgaard 22 april 2002
//Part of WaveWatcher -> Uses ww_uptime.pl function
//-----------------------------------------------------------
require_once("../classes/networks.php");
require_once("../classes/user.php");
session_start();

//If the user hasnt logged in then send him to index.php
//$user = new User();
//if (!$user->IsLoggedIn())
  //      header("Location: ../html/login.php");
//If nothing is posted then the user should be send to networks.php.
//if (!$node_id)  header("Location: ../html/networks.php");

function exec2stdout2html($exec_string){
//exec_string is executed, using escapeshellcmd as safty meassure! And stdout is formatted for HTML and printed!
exec (escapeshellcmd($exec_string),$Array_stdout,$retval);
$out = "";
for ($i = 0 ; $i < count ($Array_stdout) ; $i++)
	$out = $out.$Array_stdout[$i]." <BR>\n";
print($out);
exec("exit(0)");
}

function getUptime($lnode_id){

        $db =  "-dwavewatcher";
        $db_ip = "-ilocalhost"; // ??? Best way ?
        $db_usr = "-ulogengine";
        $db_pwd = "-pwwpass";
        $node_ip = "-n".$lnode_id;
        $time_1 = "-b200204190000";//$time();
        $time_0 = "-e200204010000";//$time_0-3600*24; // One day in seconds
        $status = "-sdown";
        $alarm = "-a5";
$str = "/var/www/html/wavewatcher/history/ww_uptime.pl ".$db." ".$db_ip." ".$db_usr." ".$db_pwd." ".$node_ip." ".$time_0." ".$time_1." ".$status." ".$alarm;

exec2stdout2html($str);
}

function upday($lnode_id){
        exec ("/var/www/html/wavewatcher/history/upday.pl $lnode_id");
        exec("exit(0)");
}
function upweek($lnode_id){
        exec ("/var/www/html/wavewatcher/history/upweek.pl $lnode_id");
        exec("exit(0)");
}
function upmonth($lnode_id){
        exec ("/var/www/html/wavewatcher/history/upmonth.pl $lnode_id");
        exec("exit(0)");
}

//Prints the networkname
function Networkname($node_id)
{
        $networks = new Networks();
        print $networks->GetNetworkname($networks->GetNetworkID($node_id));
}

//Prints the nodename
function Nodename($node_id)
{
        $networks = new Networks();
        print $networks->GetNodename($node_id);
}

//Print the network ID
function NetworkID($node_id)
{
        $networks = new Networks();
        print $networks->GetNetworkID($node_id);
}
?>

<html>
        <head>
                <title></title>
                <meta http-equiv="expires" content="Fri, 5 Apr 1996 23:59:59 GMT">
        <script language=javascript>
                <!--
                        // Check if framework is ok
                       // if (parent.location.href == self.location.href)
                         //       top.window.location.href = 'index.php';

                        //linktimeID = window.setTimeout("Reload(<?print "$node_id"?>)",30000);

                        function SelectNode(id)
                        {
                                document.selectnode.node_id.value = id;
                                document.selectnode.submit();
                        }
                        function Reload(id)
                        {
                                document.reload.node_id.value = id;
                                document.reload.submit();
                        }

                        //This function submits the invisible form when a link is clicked.
                        function SelectNetwork(id)
                        {
                                document.network.network_id.value = id;
                                document.network.submit();
                        }
                -->
                </script>
        </head>
<body bgcolor="#ffffff">
 <table width = "100%" height=25 align="center" border="0">
  <tr>
                                <td>
<font face="Verdana, Arial, Helvetica, sans-serif" size=1 color="#000000"><b><a href="../html/networks.php">Wavewatcher</a> >
<a href="javascript:SelectNetwork(<?NetworkID($node_id)?>)"><?Networkname($node_id)?></a> >
<?Nodename($node_id)?> > Uptime History</b></font>
                                </td>
<td align=right>
<font face="arial,helvetica,sans-serif" size=1>
  <a href="../html/home.php" target="main">home</a>
  <a href="../html/networks.php" target="main">nodes</a>
  <a href="../html/profile.php" target="main">profile</a>
  <a href="../html/logout.php" target="main">logout</a>
</font>
</td>
                        </tr>
                </table>
                <table width="100%" align="center" border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
                        <tr>
                                <td>
                                        <table width="100%" border="0" cellspacing="0" cellpadding="2">
                                                <tr>
                                                        <td bgcolor="#515173">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><b>Uptime for node <?Nodename($node_id)?> [Antennspecialisten]</b></font>
                                                        </td>
                                                </tr>
                                                <tr><td bgcolor="#ffffff">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><b><? getUptime('192.168.68.240') ?></b></font>
                                                </td></tr>
                                        </table>
                                </td>
                        </tr>
                </table>
                <form name="network" method="post" action="../html/nodes.php">
                <input type="hidden" name="network_id" value="">
                </form>
                <form name="reload" method="post" action="ww_uptime.php">
                <input type="hidden" name="node_id" value="">
                </form>
                <form name="selectnode" method="post" action="../html/clients.php">
                <input type="hidden" name="node_id" value="">
                </form>

        </body>
</html>
Return current item: WaveWatcher