File: 0.02.21a/server/web/node.php (View as Code)

1: 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 Foobar. 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:
36: 37: //echo "Node: ".$_REQUEST['nodeid']."

";
38: 39: echo "
"; 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.

";
46: Screen_Footer(); 47: exit(); 48: } 49: $NATS->DB->Free($r); 50: 51: echo ""; 52: 53: echo ""; 58: 59: echo ""; 66: 67: echo ""; 72: 73: echo ""; 78: 79: echo ""; 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 ""; 100: 101: if ($NATS_Session->userlevel>4) echo ""; 102: 103: echo "
54: Node Name 55: :"; 56: echo $row['nodename']; 57: echo "
60: Status 61: :"; 62: echo ""; 63: echo aText($row['alertlevel']); 64: echo ""; 65: echo "
68: Hostname 69: :"; 70: echo $row['hostname']; 71: echo "
74: Description 75: :"; 76: echo $row['nodedesc']; 77: echo "
80: Enabled 81: :"; 82: if ($row['nodeenabled']==1) $s="Yes"; 83: else $s="No"; 84: echo $s; 85: echo "
91: Alert 92: :"; 93: if ($arow=$NATS->DB->Fetch_Array($ar)) 94: { 95: echo "Yes - ".aText($arow['alertlevel'])." "; 96: echo "(Opened ".dtago($arow['openedx']).")"; 97: } 98: else echo "No [ Alert History ]"; 99: echo "
Edit :Edit Node Options
";
104: 105: echo "
 "; 106: np_tiny($_REQUEST['nodeid']); 107: echo "
";
108: 109: echo "

";
110: 111: echo "Local Tests

";
112: 113: echo ""; 114: 115: $q="SELECT * FROM fnlocaltest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; 116: $r=$NATS->DB->Query($q); 117: while ($row=$NATS->DB->Fetch_Array($r)) 118: { 119: echo ""; 126: 127: echo ""; 128: 129: echo ""; 130: 131: echo ""; 136: 137: echo ""; 138: } 139: 140: echo "
"; 120: 121: if (strlen($row['testparam'])>10) $tp=substr($row['testparam'],0,8).".."; 122: else $tp=$row['testparam']; 123: echo lText($row['testtype']); 124: if ($tp!="") echo " (".$tp.")"; 125: echo "".aText($row['alertlevel'])."(".dtago($row['lastrunx']).")"; 132: if (($row['testrecord']==1)||($row['testtype']=="ICMP")) 133: echo "[ History ]"; 134: else echo " "; 135: echo "
";
141: 142: 143: ?> 144: 145: 146: 147: Screen_Footer(); 148: ?> 149: