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