<?
/****************************************************************************
* Name: tablepop.php
* Authors: Dominic Kilbride Antennspecialisten.se
/***************************************************************************/
require_once("../classes/user.php");
session_start(); //Start session
$user = new User();
//If the user hasn't logged in then we should send him to the loginpage.
if(!$user->IsLoggedIn())
header("Location: index.php");
?>
<html>
<head>
<title>Table</title>
<link href="css/style1.css" rel="styleSheet" type="text/css">
<script language="JavaScript">
function HideLoadingText()
{
var hideItem = null;
if (document.getElementById)
hideItem = document.getElementById('waitDiv').style;
else if (document.all)
hideItem = document.all['waitDiv'].style;
else if (document.layers)
hideItem = document.layers['waitDiv'];
hideItem.visibility = 'hidden';
}
</script>
<?PrintStyleTag()?>
</head>
<body>
<?
if($HTTP_GET_VARS){
if($days == 1){
$node_id = $HTTP_GET_VARS["node_id"];
$str = "../bin/ww_uptime.pl -l 1 -n ".$node_id;
exec2stdout2html($str);
}
elseif($days == "7"){
$node_id = $HTTP_GET_VARS["node_id"];
$str = "../bin/ww_uptime.pl -l 7 -n ".$node_id;
exec2stdout2html($str);
}
elseif($days == "30"){
$node_id = $HTTP_GET_VARS["node_id"];
$str = "../bin/ww_uptime.pl -l 30 -n ".$node_id;
exec2stdout2html($str);
}
}
else
header("Location: index.php");
// Returns the browser that the user uses.
function GetBrowser()
{
if((ereg("Nav", getenv("HTTP_USER_AGENT"))) ||
(ereg("Gold", getenv("HTTP_USER_AGENT"))) ||
(ereg("X11", getenv("HTTP_USER_AGENT"))) ||
(ereg("Mozilla", getenv("HTTP_USER_AGENT"))) ||
(ereg("Netscape", getenv("HTTP_USER_AGENT"))) AND
(!ereg("MSIE", getenv("HTTP_USER_AGENT"))))
return "Netscape";
elseif(ereg("MSIE", getenv("HTTP_USER_AGENT")))
return "MSIE";
return "Other";
}
function PrintStyleTag()
{
if (GetBrowser()!="Netscape")
{
print "<style>";
print ".graph{background-image:url(img/loading.png);background-repeat:no-repeat;background-attachment:scroll;}";
print "</style>";
}
}
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);
print "<table width=\"320\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#000000\" align=\"center\"><tr><td>";
print "<table width=\"320\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr>";
print "<td bgcolor=\"#515173\"><font face=\"arial\" size=\"2\" color=\"FFFFFF\">"."<b><center>".$Array_stdout[1]."</b></center></td></tr>\n";
print "<td bgcolor=\"#515173\"><font face=\"arial\" size=\"2\" color=\"FFFFFF\">".$Array_stdout[2]."</td></tr>\n";
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">";
print "<tr>";
print "<td width=\"320\" bgcolor=\"#F2F2F2\">".$Array_stdout[3]."</td>\n";
print "</tr>";
for ($i = 4 ; $i < count ($Array_stdout) ; $i++){
//$out = $out.$Array_stdout[$i]." <BR>\n";
$out = $Array_stdout[$i];
print "<tr><td width=\"320\" bgcolor=\"#F2F2F2\">";
print($out);
print"</td></tr>\n";
}
exec("exit(0)");
print "</table>";
print "</td><tr></table>";
}
?>
</body>
</html>