0){ print "\n"; print "\n"; print "\n"; for($cnt=0; $cnt<$numRows; $cnt++){ $defconLevel = mysql_result($result,$cnt,"defcon"); $defconCount = mysql_result($result,$cnt,"numEvents"); print ""; if(($defconLevel == 1)&&($defconCount > 0)){ print "\n"; print "\n"; } else { print "\n"; print "\n"; } print "\n"; } print "
LOG INFO
DEFCON#
DEFCON $defconLevel $defconCountDEFCON $defconLevel$defconCount
\n"; print "
\n"; } } } //end defconBox() //// // This function displays the messages in the eventlog in a sortable table and displays links for // deleting each individual message or clearing the table. // // This table can be displayed anywhere, but will post to procPage which is expected to handle // the detection of the GET command and call the appropriate deleteEvent(...) function. // // NOTE: Deleting the whole table is not implemented yet. //// function defconTable(){ GLOBAL $procPage; $PHP_SELF = $_SERVER['PHP_SELF']; $sortBy = "defcon"; $ascending = true; if(isset($_GET['sortBy'])){$sortBy = $_GET['sortBy'];} if(isset($_GET['ascending'])){$ascending = $_GET['ascending'];} $desc = ""; if($ascending){}else{$desc = " DESC";} if(($sortBy!="defcon")&&($sortBy!="message")&&($sortBy!="timestamp")){ $sortBy = "";//avoid mySQL hack attacks (piggybacking, etc.) $orderBy = ""; } else { $orderBy = "ORDER BY $sortBy"; } if($orderBy != ""){ $orderBy .= $desc; } $db = dil_connect(); $queryString = "SELECT * FROM eventlog $orderBy"; if($result = mysql_query($queryString,$db)){ print "
\n"; $link = "$procPage?deleteEvent=true&id=all"; print "\n"; $numRows = mysql_num_rows($result); if($numRows > 0){ print ""; $link = "$PHP_SELF?sortBy=defcon"; if(($sortBy=="defcon")&&($ascending)){ $link .= "&ascending=0"; } print "\n"; $link = "$PHP_SELF?sortBy=message"; if(($sortBy=="message")&&($ascending)){ $link .= "&ascending=0"; } print "\n"; print "\n"; $link = "$PHP_SELF?sortBy=timestamp"; if(($sortBy=="timestamp")&&($ascending)){ $link .= "&ascending=0"; } print "\n"; print "\n"; for($cnt=0; $cnt<$numRows; $cnt++){ $id = mysql_result($result,$cnt,"id"); $defconLevel = mysql_result($result,$cnt,"defcon"); $message = mysql_result($result,$cnt,"message"); $timeStamp = mysql_result($result,$cnt,"timestamp"); $style = ($cnt%2)?"style='border-top: #000 1px solid;background-color: #cccccc'":""; if($defconLevel==1){ $style = "style='border-top: #000 1px solid;background-color: #ff5555'"; } print ""; print "\n"; print "\n"; print "\n"; $link = "$procPage?deleteEvent=true&id=$id"; print "\n"; print "\n"; } } else { print ""; } print "
Event Log [clear all]
DEFCON [sort]Message [sort]Message [sort]Timestamp [sort]\n";//this is the "delete" column print "
$defconLevel$message$timeStampDelete
There are currently no events in the event log.

\n"; } else { dispError("Could not access event log with query:
$queryString"); } } //end defconTable() //// // This function will delete the event passed in through the '$id' parameter. If nothing is passed // in, then it will look for the correct values in the GET array. If no id is found there either, // nothing is done. // // This function is NOT responsible for checking administrator priviledges, that should be done before // calling this function. //// function deleteEvent($id=""){ if($id==""){ if((isset($_GET['deleteEvent']))&&(isset($_GET['id']))&&($_GET['deleteEvent']=="true")){ $id = $_GET['id']; } } if($id!=""){ $db = dil_connect(); if($id=="all"){ $queryString = "TRUNCATE TABLE eventlog"; } else { $queryString = "DELETE FROM eventlog WHERE id=$id"; } if(mysql_query($queryString,$db)){ if($id=="all"){ dispSuccess("All events in event-log deleted."); } else { dispSuccess("Event #$id deleted."); } } else { dispError("Could not delete event using query:
$queryString"); } } } //end deleteEvent(...) ?>