File: 1.17.5a/server/web/monitor.php (View as Code)

1: 2: /* ------------------------------------------------------------- 3: This file is part of FreeNATS 4: 5: FreeNATS is (C) Copyright 2008-2010 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: 27: // Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0 28: if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true; 29: else $timeskip=false; 30: 31: if (!$NATS_Session->Check($NATS->DB,$timeskip)) 32: { 33: header("Location: ./?login_msg=Invalid+Or+Expired+Session"); 34: exit(); 35: } 36: if ($NATS_Session->userlevel<1) UL_Error($NATS->Lang->Item("live.monitor")); 37: 38: if (isset($_REQUEST['style'])) 39: { 40: $style=$_REQUEST['style']; 41: setcookie("fn_monitorstyle",$style); 42: } 43: else if (isset($_COOKIE['fn_monitorstyle'])) 44: { 45: $style=$_COOKIE['fn_monitorstyle']; 46: } 47: else $style="standard"; 48: 49: if ($style=="") $style="standard"; 50: 51: Screen_Header($NATS->Lang->Item("live.monitor"),1,1,""); 52: ?> 53:
54: 55: 58: 59: 60: /* 61: echo "\n"; 64: */ 65: ?> 66: 67: 68: if ($NATS->Cfg->Get("site.monitor.popup",1)==0) $monpopup=false; 69: else $monpopup=true; 70: 71: if ($monpopup) 72: { 73: echo "
";
74: echo "\n"; 76: } 77: ?> 78: 79: 114: 115: 116: 117: 118: ob_end_flush(); 119: 120: if ($style=="standard") 121: { 122: 123: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 124: $r=$NATS->DB->Query($q); 125: 126: if ($NATS->DB->Num_Rows($r)>0) 127: { 128: echo ""; 129: $a=0; 130: while ($row=$NATS->DB->Fetch_Array($r)) 131: { 132: if ($NATS->isUserAllowedGroup($NATS_Session->username,$row['groupid'])) 133: { 134: if ($a==0) echo ""; 135: echo ""; 138: $a++; 139: if ($a==2) 140: { 141: $a=0; 142: echo ""; 143: } 144: } 145: } 146: if ($a>0) echo ""; 147: echo "
"; 136: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 137: echo "
";
148: echo "

";
149: } 150: 151: 152: $NATS->DB->Free($r); 153: 154: 155: $q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; 156: $r=$NATS->DB->Query($q); 157: 158: echo ""; 159: $a=0; 160: while ($row=$NATS->DB->Fetch_Array($r)) 161: { 162: if ($NATS->isUserAllowedNode($NATS_Session->username,$row['nodeid'])) 163: { 164: if ($a==0) echo ""; 165: echo ""; 168: $a++; 169: if ($a==5) 170: { 171: $a=0; 172: echo ""; 173: } 174: } 175: } 176: if ($a>0) echo ""; 177: echo "
"; 166: np_tiny($row['nodeid'],true,$row['nodename'],$monpopup); 167: echo "
";
178: $NATS->DB->Free($r); 179: } 180: 181: else if ($style=="alerting") 182: { 183: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 184: $r=$NATS->DB->Query($q); 185: 186: echo ""; 187: $a=0; 188: while ($row=$NATS->DB->Fetch_Array($r)) 189: { 190: if ($NATS->GroupAlertLevel($row['groupid'])>0 && $NATS->isUserAllowedGroup($NATS_Session->username,$row['groupid'])) 191: { 192: if ($a==0) echo ""; 193: echo ""; 196: $a++; 197: if ($a==2) 198: { 199: $a=0; 200: echo ""; 201: } 202: } 203: } 204: if ($a>0) echo ""; 205: echo "
"; 194: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); 195: echo "
";
206: 207: 208: $NATS->DB->Free($r); 209: 210: echo "

";
211: 212: $q="SELECT * FROM fnnode WHERE alertlevel!=0 ORDER BY alertlevel DESC, weight ASC"; 213: $r=$NATS->DB->Query($q); 214: 215: echo ""; 216: $a=0; 217: while ($row=$NATS->DB->Fetch_Array($r)) 218: { 219: if ($NATS->isUserAllowedNode($NATS_Session->username,$row['nodeid'])) 220: { 221: if ($a==0) echo ""; 222: echo ""; 225: $a++; 226: if ($a==5) 227: { 228: $a=0; 229: echo ""; 230: } 231: } 232: } 233: if ($a>0) echo ""; 234: echo "
"; 223: np_tiny($row['nodeid'],true,$row['nodename'],$monpopup); 224: echo "
";
235: $NATS->DB->Free($r); 236: } 237: 238: else if ($style=="groups") 239: { 240: $q="SELECT * FROM fngroup ORDER BY weight ASC"; 241: $r=$NATS->DB->Query($q); 242: 243: echo ""; 244: $a=0; 245: while ($row=$NATS->DB->Fetch_Array($r)) 246: { 247: if ($NATS->isUserAllowedGroup($NATS_Session->username,$row['groupid'])) 248: { 249: if ($a==0) echo ""; 250: echo ""; 253: $a++; 254: if ($a==2) 255: { 256: $a=0; 257: echo ""; 258: } 259: } 260: } 261: if ($a>0) echo ""; 262: echo "
"; 251: ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon'],$monpopup); 252: echo "
";
263: 264: 265: $NATS->DB->Free($r); 266: } 267: 268: else if ($style=="nodes") 269: { 270: $q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; 271: $r=$NATS->DB->Query($q); 272: 273: echo ""; 274: $a=0; 275: while ($row=$NATS->DB->Fetch_Array($r)) 276: { 277: if ($NATS->isUserAllowedNode($NATS_Session->username,$row['nodeid'])) 278: { 279: if ($a==0) echo ""; 280: echo ""; 283: $a++; 284: if ($a==2) 285: { 286: $a=0; 287: echo ""; 288: } 289: } 290: } 291: if ($a>0) echo ""; 292: echo "
"; 281: np_big($row['nodeid'],$row['nodename'],$row['nodedesc'],$row['nodeicon'],$monpopup); 282: echo "
";
293: 294: 295: $NATS->DB->Free($r); 296: } 297: 298: else 299: { 300: echo "Sorry - unknown display style type

";
301: } 302: 303: mt_srand(microtime()*1000000); 304: if (mt_rand(0,100)==50) $track_if_enabled=true; 305: else $track_if_enabled=false; 306: 307: Screen_Footer($track_if_enabled); 308: ?> 309: