Location: PHPKode > projects > WaveWatcher > wavewatcher3/html/nodereport.php
<?
/****************************************************************************
 * Name:		nodereport.php
 * Authors:		Niklas Påhlsson, Pierre Svärd, Petter Miller, Mats Hörberg
/***************************************************************************/
require_once("../classes/network.php");
require_once("../classes/user.php");
session_start();										//Start session

$user = new User();
$network = new Network();

//If the user hasn't logged in then we should send him to the loginpage.
if (!$user->IsLoggedIn())
	header("Location: index.php");

if ($HTTP_GET_VARS)
	$node_id = $HTTP_GET_VARS["node_id"];
else
	header("Location: index.php");

if($node_id == 0)
	header("Location: index.php");

$result = $network->GetNodeDetails($node_id);
if(List($node_type_id, $network_id, $parent_node_id, $node_name, $node_pass, $node_ip, $location, $monitor, $log, $signal, $alarm, $node_type_name, $network_name) = $network->FetchRow($result))
{
	$parent_node_name = $network->GetNodeName($parent_node_id);

	$clients_up = $network->GetClientsUpCount($node_id);
	$clients_dn = $network->GetClientsDnCount($node_id);
	$clients_wn = $network->GetClientsWnCount($node_id);

	$status = $network->GetNodeStatus($node_id);
	if($status == 0)
		$status_text = "Up";
	else if($status == 1)
		$status_text = "Down";
	else if($status == 2)
		$status_text = "Unknown";

	$interfaces = $network->GetNumberOfInterfaces($node_id);
}

function PrintUptimeGraph($node_id)
{
	print "<tr>";
	print "<td colspan=\"2\">";
	print "<img src=\"graph/uptime.php?node_id=".$node_id."&drawmode=2&mode=1&xpos=24\">";
	print "</td>";
	print "</tr>";
	print "<tr>";
	print "<td>24 hours</td>";
	print "</tr>";
	print "<tr>";		
	print "<td width=\"25\">&nbsp;</td>";
	print "</tr>";

	print "<tr>";
	print "<td colspan=\"2\">";
	print "<img src=\"graph/uptime.php?node_id=".$node_id."&drawmode=2&mode=2&xpos=7\">";
	print "</td>";
	print "</tr>";
	print "<tr>";
	print "<td>1 week</td>";
	print "</tr>";
	print "<tr>";		
	print "<td width=\"25\">&nbsp;</td>";
	print "</tr>";

	print "<tr>";
	print "<td colspan=\"2\">";
	print "<img src=\"graph/uptime.php?node_id=".$node_id."&drawmode=2&mode=3&xpos=30\">";
	print "</td>";
	print "</tr>";
	print "<tr>";
	print "<td>1 month (30 days)</td>";
	print "</tr>";
	print "<tr>";		
	print "<td width=\"25\">&nbsp;</td>";
	print "</tr>";
}

function PrintDataRateGraph($node_id, $interfaces)
{
	for($i=1; $i<=$interfaces; $i++)
	{
		print "<tr>";
		print "<td width=\"25\">&nbsp;</td>";
		print "</tr>";
		print "<tr>";		
		print "<td colspan=\"2\"><img src=\"graph/speed.php?node_id=".$node_id."&interface=".$i."&mode=1&xpos=24\"></td>";
		print "</tr>";
		print "<tr>";		
		print "<td>24 hours</td>";
		print "</tr>";

		print "<tr>";		
		print "<td width=\"25\">&nbsp;</td>";
		print "</tr>";
		print "<tr>";		
		print "<td colspan=\"2\"><img src=\"graph/speed.php?node_id=".$node_id."&interface=".$i."&mode=2&xpos=7\"></td>";
		print "</tr>";
		print "<tr>";		
		print "<td>1 week</td>";
		print "</tr>";

		print "<tr>";		
		print "<td width=\"25\">&nbsp;</td>";
		print "</tr>";
		print "<tr>";		
		print "<td colspan=\"2\"><img src=\"graph/speed.php?node_id=".$node_id."&interface=".$i."&mode=3&xpos=30\"></td>";
		print "</tr>";
		print "<tr>";		
		print "<td>1 month (30 days)</td>";
		print "</tr>";
	}
}
?>
<html>
<head>
	<title><?=$node_name?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link href="css/style1.css" rel="styleSheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
<table width="320" border="0">
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Name</td>
    <td width="200"> <?=$node_name?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">IP address</td>
    <td width="200"> <?=$node_ip?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Network</td>
    <td width="200"> <?=$network_name?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Parent node</td>
    <td width="200"> <?=$parent_node_name?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Type</td>
    <td width="200"> <?=$node_type_name?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Clients</td>
    <td width="200"> <?="$clients_up"."up, "."$clients_dn"."dn, "."$clients_wn"."wn"?></td>
  </tr>
  <tr> 
    <td width="120" bgcolor="#F2F2F2">Status</td>
    <td width="200"> <?=$status_text?></td>
  </tr>
  <tr>
    <td width="120" bgcolor="#F2F2F2">Location</td>
    <td width="200"> <?=$location?></td>
  </tr>
  <tr>		
	<td width="25">&nbsp;</td>
  </tr>
  <?PrintUptimeGraph($node_id)?>
  <?PrintDataRateGraph($node_id, $interfaces)?>
</table>
</body>
</html>
Return current item: WaveWatcher