File: 0.02.54a/server/web/main.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: ob_end_flush();
 32: Screen_Header("Monitoring Interface",1);
 33: 
 34: if (isset($_REQUEST['message'])) 
 35: 	{
 36: 	echo "<b>".$_REQUEST['message']."</b><br>";
 37: 	$poplist[]=$_REQUEST['message'];
 38: 	}
 39: 
 40: ?>
 41: <br>
 42: <?php
 43: echo "<b class=\"minortitle\">Nodes</b> ".hlink("Node")."<br><br>";
 44: $q="SELECT nodeid,nodename,alertlevel FROM fnnode ORDER BY weight ASC";
 45: $r=$NATS->DB->Query($q);
 46: 
 47: echo "<table class=\"nicetable\">";
 48: echo "<tr><td><b>Node</b></td><td colspan=2><b>Options</b></td></tr>";
 49: $f=0;
 50: $l=$NATS->DB->Num_Rows($r);
 51: while ($row=$NATS->DB->Fetch_Array($r))
 52: 	{
 53: 	echo "<tr><td align=left>";
 54: 	echo "<a href=node.php?nodeid=".$row['nodeid'].">";
 55: 	
 56: 	echo "<b class=\"al".$row['alertlevel']."\">";
 57: 	echo $row['nodename'];
 58: 	echo "</b>";
 59: 	
 60: 	echo "</a> ";
 61: 	echo "(".$row['nodeid'].")";
 62: 	echo "</td><td align=left>";
 63: 	echo "<a href=node.edit.php?nodeid=".$row['nodeid'].">Edit</a> | ";
 64: 	echo "<a href=node.action.php?action=delete&nodeid=".$row['nodeid'].">Delete"."</a> ";
 65: 	echo "</td>";
 66: 	
 67: 	echo "<td>";
 68: 	if ($f==0) echo "<img src=images/arrows/off/arrow_top.png>";
 69: 	else 
 70: 		{
 71: 		echo "<a href=node.action.php?nodeid=".$row['nodeid']."&action=move&dir=up>";
 72: 		echo "<img src=\"images/arrows/on/arrow_top.png\" border=0>";
 73: 		echo "</a>";
 74: 		}
 75: 	
 76: 	if ($f>=($l-1)) echo "<img src=images/arrows/off/arrow_down.png>";
 77: 	else 
 78: 		{
 79: 		echo "<a href=node.action.php?nodeid=".$row['nodeid']."&action=move&dir=down>";
 80: 		echo "<img src=\"images/arrows/on/arrow_down.png\" border=0>";
 81: 		echo "</a>";
 82: 		}
 83: 		
 84: 	echo "</td>";
 85: 	$f++;
 86: 	
 87: 	echo "</tr>";
 88: 	}
 89: echo "<form action=node.action.php><input type=hidden name=action value=create>";
 90: echo "<tr><td><input type=text name=nodeid size=20 maxlenth=32></td><td><input type=submit value=\"Create Node\"></td>";
 91: echo "<td>".hlink("Node:Create")."</td></tr></form>";
 92: 
 93: $fx=time();
 94: $sx=$fx-(60*60*24);
 95: echo "<tr><td colspan=2><b>Summary: </b><a href=summary.test.php?nodeid=*>Today</a> | ";
 96: echo "<a href=summary.test.php?nodeid=*&startx=".$sx."&finishx=".$fx.">Last 24 Hrs</a>";
 97: echo "</td></tr>";
 98: 
 99: echo "</table>";
100: 
101: echo "<br><br>";
102: echo "<b class=\"minortitle\">Node Groups</b> ".hlink("Group")."<br><br>";
103: 
104: $q="SELECT groupid,groupname FROM fngroup ORDER BY weight ASC";
105: $r=$NATS->DB->Query($q);
106: $f=0;
107: echo "<table class=\"nicetable\">";
108: $l=$NATS->DB->Num_Rows($r);
109: while ($row=$NATS->DB->Fetch_Array($r))
110: 	{
111: 	echo "<tr><td><a href=group.php?groupid=".$row['groupid']."><b class=\"al".$NATS->GroupAlertLevel($row['groupid'])."\">".$row['groupname']."</b></a></td>";
112: 	echo "<td><a href=group.edit.php?groupid=".$row['groupid'].">Edit</a> | <a href=group.action.php?action=delete&groupid=".$row['groupid'].">Delete</a></td>";
113: 	echo "<td>";
114: 	
115: 	if ($f==0) echo "<img src=images/arrows/off/arrow_top.png>";
116: 	else 
117: 		{
118: 		echo "<a href=group.action.php?groupid=".$row['groupid']."&action=move&dir=up>";
119: 		echo "<img src=\"images/arrows/on/arrow_top.png\" border=0>";
120: 		echo "</a>";
121: 		}
122: 	
123: 	if ($f>=($l-1)) echo "<img src=images/arrows/off/arrow_down.png>";
124: 	else 
125: 		{
126: 		echo "<a href=group.action.php?groupid=".$row['groupid']."&action=move&dir=down>";
127: 		echo "<img src=\"images/arrows/on/arrow_down.png\" border=0>";
128: 		echo "</a>";
129: 		}
130: 		
131: 	echo "</td>";
132: 	$f++;
133: 	
134: 	echo "</tr>";
135: 	}
136: echo "<form action=group.action.php method=post>";
137: echo "<input type=hidden name=action value=create>";
138: echo "<tr><td><input type=text size=20 name=groupname maxlength=120></td><td><input type=submit value=\"Create Group\">";
139: echo "</td><td>".hlink("Group:Create")."</td></tr></form>";
140: echo "</table>";
141: 
142: if ($NATS->Cfg->Get("dev.views")==1)
143: {
144: echo "<br><br>";
145: echo "<b class=\"minortitle\">Views</b> ".hlink("View")."<br><br>";
146: echo "<table class=\"nicetable\">";
147: // get views...
148: $q="SELECT viewid,vtitle FROM fnview";
149: $r=$NATS->DB->Query($q);
150: while ($row=$NATS->DB->Fetch_Array($r))
151: 	{
152: 	echo "<tr><td>";
153: 	echo "<a href=view.php?viewid=".$row['viewid'].">".$row['vtitle']."</a>";
154: 	echo "</td><td>";
155: 	echo "<a href=view.edit.php?viewid=".$row['viewid'].">Edit</a> | <a href=view.edit.php?viewid=".$row['viewid']."&action=delete>Delete</a>";
156: 	echo "</td></tr>";
157: 	}
158: 
159: 
160: echo "<form action=view.edit.php method=post><input type=hidden name=action value=create>";
161: echo "<tr><td><input type=text name=vtitle size=20 maxlength=64></td><td><input type=submit value=\"Create View\"> ";
162: echo hlink("View:Create")."</td></tr></form>";
163: echo "</table>";
164: }
165: ?>
166: 
167: 
168: <?php
169: Screen_Footer();
170: /* old PhoneHome Ping Tracker - now in screen as a png
171: $t=$NATS->Cfg->Get("freenats.tracker");
172: if ( ($t!="") && ($t>0) )
173: 	$NATS->PhoneHome();
174: */
175: ?>
176: