File: 0.02.69a/server/web/node.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeNATS
  4: 
  5: FreeNATS is (C) Copyright 2008 PurplePixie Systems
  6: 
  7: FreeNATS is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeNATS is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeNATS.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freenats
 21: -------------------------------------------------------------- */
 22: 
 23: ob_start();
 24: require("include.php");
 25: $NATS->Start();
 26: if (!$NATS_Session->Check($NATS->DB))
 27: 	{
 28: 	header("Location: ./?login_msg=Invalid+Or+Expired+Session");
 29: 	exit();
 30: 	}
 31: if ($NATS_Session->userlevel<1) UL_Error("View Node");
 32: ob_end_flush();
 33: Screen_Header("Viewing Node ".$_REQUEST['nodeid'],1);
 34: ?>
 35: <br>
 36: <?php
 37: //echo "<b class=\"minortitle\">Node: ".$_REQUEST['nodeid']."</b><br><br>";
 38: 
 39: echo "<table border=0><tr><td align=left valign=top>";
 40: 
 41: $q="SELECT * FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" LIMIT 0,1";
 42: $r=$NATS->DB->Query($q);
 43: if (!$row=$NATS->DB->Fetch_Array($r))
 44: 	{
 45: 	echo "No such node.<br><br>";
 46: 	Screen_Footer();
 47: 	exit();
 48: 	}
 49: $NATS->DB->Free($r);
 50: 
 51: echo "<table class=\"nicetable\">";
 52: 
 53: echo "<tr><td align=right>
 54: Node Name
 55: :</td><td align=left>";
 56: echo $row['nodename'];
 57: echo "</td></tr>";
 58: 
 59: echo "<tr><td align=right>
 60: Status
 61: :</td><td align=left>";
 62: echo "<b class=\"al".$row['alertlevel']."\">";
 63: echo oText($row['alertlevel']);
 64: echo "</b>";
 65: echo "</td></tr>";
 66: 
 67: echo "<tr><td align=right>
 68: Hostname
 69: :</td><td align=left>";
 70: echo $row['hostname'];
 71: echo "&nbsp;</td></tr>";
 72: 
 73: echo "<tr><td align=right>
 74: Description
 75: :</td><td align=left>";
 76: echo $row['nodedesc'];
 77: echo "&nbsp;</td></tr>";
 78: 
 79: echo "<tr><td align=right>
 80: Enabled
 81: :</td><td align=left>";
 82: if ($row['nodeenabled']==1) $s="Yes";
 83: else $s="No";
 84: echo $s;
 85: echo "</td></tr>";
 86: 
 87: $aq="SELECT alertid,alertlevel,openedx FROM fnalert WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND closedx=0 LIMIT 0,1";
 88: //echo $aq;
 89: $ar=$NATS->DB->Query($aq);
 90: echo "<tr><td align=right>
 91: Alert 
 92: :</td><td align=left>";
 93: if ($arow=$NATS->DB->Fetch_Array($ar))
 94: 	{
 95: 	echo "<a href=history.alert.php?nodeid=".$_REQUEST['nodeid']."><b class=\"al".$arow['alertlevel']."\">Yes - ".oText($arow['alertlevel'])."</b></a> ";
 96: 	echo "(Opened ".dtago($arow['openedx']).")";
 97: 	}
 98: else echo "<b>No</b> [ <a href=history.alert.php?nodeid=".$_REQUEST['nodeid'].">Alert History</a> ]";
 99: echo "</td></tr>";
100: 
101: if ($NATS_Session->userlevel>4) echo "<tr><td align=right>Edit :</td><td align=left><a href=node.edit.php?nodeid=".$_REQUEST['nodeid'].">Edit Node Options</a></td></tr>";
102: 
103: echo "<tr><td align=right>Summary :</td><td align=left>";
104: $finishx=time();
105: $startx=$finishx-(60*60*24);
106: echo "<a href=summary.test.php?nodeid=".$_REQUEST['nodeid']."&startx=".$startx."&finishx=".$finishx.">Last 24hrs</a> | ";
107: echo "<a href=summary.test.php?nodeid=".$_REQUEST['nodeid'].">Today</a>";
108: echo "</td></tr>";
109: 
110: echo "</table>";
111: 
112: echo "</td><td style=\"width: 50px;\">&nbsp;</td><td align=left valign=top>";
113: np_tiny($_REQUEST['nodeid']);
114: echo "</td></tr></table>";
115: 
116: echo "<br><br>";
117: 
118: echo "<b class=\"minortitle\">Local Tests</b><br><br>";
119: 
120: echo "<table class=\"nicetable\">";
121: 
122: $q="SELECT * FROM fnlocaltest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\"";
123: $r=$NATS->DB->Query($q);
124: while ($row=$NATS->DB->Fetch_Array($r))
125: 	{
126: 	echo "<tr><td>";
127: 	
128: 	if ($row['testname']=="")
129: 		{
130: 		if (strlen($row['testparam'])>10) $tp=substr($row['testparam'],0,8)."..";
131: 		else $tp=$row['testparam'];
132: 		echo lText($row['testtype']);
133: 		if ($tp!="") echo " (".$tp.")";
134: 		}
135: 	else echo $row['testname'];
136: 	echo "</td>";
137: 
138: 	echo "<td><b class=\"al".$row['alertlevel']."\">".oText($row['alertlevel'])."</b></td>";
139: 	
140: 	echo "<td>(".dtago($row['lastrunx']).")</td>";
141: 	
142: 	echo "<td>";
143: 	if (($row['testrecord']==1)||($row['testtype']=="ICMP")) 
144: 		echo "[ <a href=\"history.test.php?testid=L".$row['localtestid']."\">History</a> ]";
145: 	else echo "&nbsp;";
146: 	echo "</td>";
147: 	
148: 	echo "</tr>";
149: 	}
150: 
151: echo "</table>";
152: 
153: 
154: ?>
155: 
156: 
157: <?php
158: Screen_Footer();
159: ?>
160: