Viewing File server/web/main.php of 0.02.59a
|
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: if (isset($_REQUEST['check_updates'])) 44: { 45: // check for updates 46: $dq="?CheckVersion=".$NATS->Version."&JSMode=1"; 47: $dl="http://www.purplepixie.org/freenats/download.php"; 48: $du=$dl.$dq; 49: echo "<b>Checking for Updates: "; 50: echo "<script type=\"text/javascript\" src=\"".$du."\"></script>\n"; 51: echo "</b><br>"; 52: echo "If this test fails you can check on the <a href=http://www.purplepixie.org/freenats/>website</a>.<br>"; 53: echo "You are currently running version "; 54: echo $NATS->Version.$NATS->Release."."; 55: echo "<br><i>You can check regularly via the top-right admin link</i><br><br>"; 56: } 57: 58: echo "<b class=\"minortitle\">Nodes</b> ".hlink("Node")."<br><br>"; 59: $q="SELECT nodeid,nodename,alertlevel FROM fnnode ORDER BY weight ASC"; 60: $r=$NATS->DB->Query($q); 61: 62: echo "<table class=\"nicetable\">"; 63: echo "<tr><td><b>Node</b></td><td colspan=2><b>Options</b></td></tr>"; 64: $f=0; 65: $l=$NATS->DB->Num_Rows($r); 66: while ($row=$NATS->DB->Fetch_Array($r)) 67: { 68: echo "<tr><td align=left>"; 69: echo "<a href=node.php?nodeid=".$row['nodeid'].">"; 70: 71: echo "<b class=\"al".$row['alertlevel']."\">"; 72: echo $row['nodename']; 73: echo "</b>"; 74: 75: echo "</a> "; 76: echo "(".$row['nodeid'].")"; 77: echo "</td><td align=left>"; 78: echo "<a href=node.edit.php?nodeid=".$row['nodeid'].">Edit</a> | "; 79: echo "<a href=node.action.php?action=delete&nodeid=".$row['nodeid'].">Delete"."</a> "; 80: echo "</td>"; 81: 82: echo "<td>"; 83: if ($f==0) echo "<img src=images/arrows/off/arrow_top.png>"; 84: else 85: { 86: echo "<a href=node.action.php?nodeid=".$row['nodeid']."&action=move&dir=up>"; 87: echo "<img src=\"images/arrows/on/arrow_top.png\" border=0>"; 88: echo "</a>"; 89: } 90: 91: if ($f>=($l-1)) echo "<img src=images/arrows/off/arrow_down.png>"; 92: else 93: { 94: echo "<a href=node.action.php?nodeid=".$row['nodeid']."&action=move&dir=down>"; 95: echo "<img src=\"images/arrows/on/arrow_down.png\" border=0>"; 96: echo "</a>"; 97: } 98: 99: echo "</td>"; 100: $f++; 101: 102: echo "</tr>"; 103: } 104: echo "<form action=node.action.php><input type=hidden name=action value=create>"; 105: echo "<tr><td><input type=text name=nodeid size=20 maxlenth=32></td><td><input type=submit value=\"Create Node\"></td>"; 106: echo "<td>".hlink("Node:Create")."</td></tr></form>"; 107: 108: $fx=time(); 109: $sx=$fx-(60*60*24); 110: echo "<tr><td colspan=2><b>Summary: </b><a href=summary.test.php?nodeid=*>Today</a> | "; 111: echo "<a href=summary.test.php?nodeid=*&startx=".$sx."&finishx=".$fx.">Last 24 Hrs</a>"; 112: echo "</td></tr>"; 113: 114: echo "</table>"; 115: 116: echo "<br><br>"; 117: echo "<b class=\"minortitle\">Node Groups</b> ".hlink("Group")."<br><br>"; 118: 119: $q="SELECT groupid,groupname FROM fngroup ORDER BY weight ASC"; 120: $r=$NATS->DB->Query($q); 121: $f=0; 122: echo "<table class=\"nicetable\">"; 123: $l=$NATS->DB->Num_Rows($r); 124: while ($row=$NATS->DB->Fetch_Array($r)) 125: { 126: echo "<tr><td><a href=group.php?groupid=".$row['groupid']."><b class=\"al".$NATS->GroupAlertLevel($row['groupid'])."\">".$row['groupname']."</b></a></td>"; 127: 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>"; 128: echo "<td>"; 129: 130: if ($f==0) echo "<img src=images/arrows/off/arrow_top.png>"; 131: else 132: { 133: echo "<a href=group.action.php?groupid=".$row['groupid']."&action=move&dir=up>"; 134: echo "<img src=\"images/arrows/on/arrow_top.png\" border=0>"; 135: echo "</a>"; 136: } 137: 138: if ($f>=($l-1)) echo "<img src=images/arrows/off/arrow_down.png>"; 139: else 140: { 141: echo "<a href=group.action.php?groupid=".$row['groupid']."&action=move&dir=down>"; 142: echo "<img src=\"images/arrows/on/arrow_down.png\" border=0>"; 143: echo "</a>"; 144: } 145: 146: echo "</td>"; 147: $f++; 148: 149: echo "</tr>"; 150: } 151: echo "<form action=group.action.php method=post>"; 152: echo "<input type=hidden name=action value=create>"; 153: echo "<tr><td><input type=text size=20 name=groupname maxlength=120></td><td><input type=submit value=\"Create Group\">"; 154: echo "</td><td>".hlink("Group:Create")."</td></tr></form>"; 155: echo "</table>"; 156: 157: if ($NATS->Cfg->Get("dev.views")==1) 158: { 159: echo "<br><br>"; 160: echo "<b class=\"minortitle\">Views</b> ".hlink("View")."<br><br>"; 161: echo "<table class=\"nicetable\">"; 162: // get views... 163: $q="SELECT viewid,vtitle FROM fnview"; 164: $r=$NATS->DB->Query($q); 165: while ($row=$NATS->DB->Fetch_Array($r)) 166: { 167: echo "<tr><td>"; 168: echo "<a href=view.php?viewid=".$row['viewid'].">".$row['vtitle']."</a>"; 169: echo "</td><td>"; 170: echo "<a href=view.edit.php?viewid=".$row['viewid'].">Edit</a> | <a href=view.edit.php?viewid=".$row['viewid']."&action=delete>Delete</a>"; 171: echo "</td></tr>"; 172: } 173: 174: 175: echo "<form action=view.edit.php method=post><input type=hidden name=action value=create>"; 176: echo "<tr><td><input type=text name=vtitle size=20 maxlength=64></td><td><input type=submit value=\"Create View\"> "; 177: echo hlink("View:Create")."</td></tr></form>"; 178: echo "</table>"; 179: } 180: ?> 181: 182: 183: <?php 184: Screen_Footer(); 185: /* old PhoneHome Ping Tracker - now in screen as a png 186: $t=$NATS->Cfg->Get("freenats.tracker"); 187: if ( ($t!="") && ($t>0) ) 188: $NATS->PhoneHome(); 189: */ 190: ?> 191: