<?php
/*
$Id: edit_report.php 579 2014-05-17 21:23:44Z bhockney $
(C) 2003-2014 by Bob Hockney <zeus@ix.netcom.com>

report editing form for webfwlog

Webfwlog is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
?>

<?php
	$link = db("open", "$database");

	if (!isset($FWLOG["refresh"]))
		$FWLOG["refresh"] = $config["refresh"];

	if (isset($FWLOG["report"])) {
		$code = $FWLOG["report"];
	} else {
		$code = "";
	}

	if (!isset($FWLOG["action"]))
		$FWLOG["action"] = "none";

	switch (strtolower($FWLOG["action"])) {
	
	case "use report":
	if (db("exists", "SELECT count(*) FROM $reports", $link)) {
		$code = '';
		if (isset($FWLOG["select_report"])) $code = $FWLOG["select_report"];
		$rownum = 0;
		$result = db("nextrow", db("statement", "SELECT definition FROM $reports WHERE code ='".db("escape", "$code", $link)."'", $link));
		if (db("exists", "SELECT last_accessed FROM $reports", $link)) {
			db("statement", "UPDATE $reports SET last_accessed = $time WHERE code = '".db("escape", "$code", $link)."'", $link);
		}
		if ("$code" == "<NEW>" or isset($result["definition"])) {
			if (isset($result["definition"]))
				$definition = unserialize($result["definition"]);
			if ("$code" == "<NEW>" or isset($FWLOG["drill_down"])) {
				unset ($FWLOG["action"]);
			} else {
				$FWLOG = $definition;
			}
			if (isset($FWLOG["data_source"]) and $FWLOG["data_source"] == "ulogd")
				$FWLOG["data_source"] = "db";
			if (!isset($FWLOG['data_table']) and isset($FWLOG["ulog_table"])) {
				$FWLOG["data_table"] = $FWLOG["ulog_table"];
				unset ($FWLOG["ulog_table"]);
			}
			if (!isset($FWLOG["data_tables"]) and isset($FWLOG["data_table"]))
				$FWLOG["data_tables"] = preg_split("/ +/", "{$FWLOG["data_table"]}");
			if (isset($FWLOG["show_sql"])) {
				$FWLOG["be_verbose"] = "{$FWLOG["show_sql"]}"; // show_sql is deprecated
				unset ($FWLOG["show_sql"]);
			}
			$FWLOG["report"] = "$code";
			require 'include/orders.php';
			require 'include/edit_report.php';
			return; // Restart edit_report with new definition, so return upon return
		} else {
			$status = "\tReport Not Defined!\n";
		}
	} // End of "use report"
		break;

	case "save as default":
	if (!isset($status) and db("exists", "SELECT count(*) FROM $reports", $link)) {
		unset ($FWLOG["action"]); // don't save these
		unset ($FWLOG["page"]);
		unset ($FWLOG['report_order']);
		unset ($FWLOG['webfwlog_sessid']);
		unset ($FWLOG["report"]);
		unset ($FWLOG["save_report"]);
		unset ($FWLOG["select_report"]);
		unset ($FWLOG["show_select_data_source"]);
		unset ($FWLOG["data_tables"]);
		unset ($FWLOG["ulog_tables"]); // deprecated
		unset ($FWLOG["ulog_table"]); // deprecated
		unset ($FWLOG["orig_report"]); // removed
		unset ($FWLOG["update_all"]); // removed
		unset ($FWLOG["show_sql"]); // deprecated, use be_verbose
		$definition = db("escape", serialize($FWLOG), $link);
		$rownum = 0;
		if (db("nextrow", db("statement", "SELECT code FROM $reports WHERE code ='default'", $link))) {
			if (!db("statement", "UPDATE $reports 
				SET description = '".db("escape", "{$FWLOG["description"]}", $link)."',
					definition  = '$definition'
				WHERE code='default'", $link)
				)
				$status = "\tERROR: REPORT NOT SAVED\n";
		} else {
			if (!db("statement", "INSERT INTO $reports
					(code, description, definition)
					VALUES ('default', '".db("escape", "{$FWLOG["description"]}", $link)."', '$definition')", $link
				))
				$status = "\tERROR: REPORT NOT SAVED\n";
		}
		$status = "\tSETTINGS SAVED AS DEFAULT!\t";
	} else {
		if (isset($status)) $status = "$status<br><font color='red'>REPORT NOT SAVED</font>";
	} //End of "save as default"
		break;

	case "create new":
	case "report editor":
	if (db("exists", "SELECT count(*) FROM $reports", $link)) {
		$rownum = 0;
		$result = db("nextrow", db("statement", "SELECT definition FROM $reports WHERE code ='default'", $link));
		if ($result["definition"]) {
			$definition = unserialize($result["definition"]);
			unset($FWLOG);
			$FWLOG = $definition;
			unset ($FWLOG["report"]);
		} else {
			$FWLOG = set_defaults($FWLOG);
			$status = "\tDefault Report Not Defined!\n";
		}
		$name = "<NEW>";
		require 'include/orders.php';
	} else {
		$FWLOG = set_defaults($FWLOG);
		$name = "<NEW>";
		require 'include/orders.php';
	}
	$_SESSION["fwlog"] = $FWLOG;
	 // End of "create new"
		break;

	default:
		 break;
	} // end switch

	$FWLOG = $FWLOG + $options;

	if (!$columns)
		$status = "\t<font color='red'>No Columns Selected!</font>\n";

	if (!isset($FWLOG["summarize"])
		and (  isset($FWLOG["c_count"])
			or isset($FWLOG["c_earliest"]) 
			or isset($FWLOG["c_latest"])
			or isset($FWLOG["c_oob_earliest"]) 
			or isset($FWLOG["c_oob_latest"]))) {
		$status = "\t<font color='red'> Cannot use grouping column<br>" .
										"if no Summarization!<br>" .
										"i.e., Occurrences,  Earliest,  Local Time ...</font>\n";
	}

	if (isset($FWLOG["summarize"])
		and (  isset($FWLOG["c_local_time"])
			or isset($FWLOG["c_oob_time_sec"]) 
			or isset($FWLOG["c_oob_time_usec"]))) {
		$status = "\t<font color='red'> Cannot use date/time column<br>" .
										"if Summarization!<br>" .
										"i.e., Local Time, OOB Time ...</font>\n";
	}

	if (isset($imported)) {
		$status = "Report {$FWLOG["report"]} Imported";
	}

		// Always executes
	$rownum = 0;
	if (!isset($name))
		$name = "$code";

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
		"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Webfwlog - Edit Report <?php print htmlspecialchars("$name", ENT_QUOTES); ?></title>
  <LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>
</head>

<body bgcolor=#FFFFFF>
	<?php if ($config["debug"]) include "include/debug.php"; ?>
	<div align="center"><h1><?php print "{$config["title"]}"; ?></h1></div>

<table align="center">
<tr>
<td>

<form action="<?php print "$self"; ?>" method="POST">  <!-- Begin of Form -->
<table border="1"> <!-- Begin of Main Table -->
<tr>  <!-- Begin of First row -->
	<td valign="top" rowspan="2" colspan="1"> <!-- Begin of basic report info -->
	<table>
		<tr>
			<td>
				<input
					style="width: 16ex; "
					type="submit"
					name="action"
					value="Refresh"
					tabindex=1
				>
				<input
					style="width: 16ex; "
					type="submit"
					name="action"
					value="Run Report"
					tabindex=1
				>
				<br>
				<input
					type="submit"
					name="action"
					value="Return to Main Menu"
					tabindex=1
				>
				<hr>
				<strong>Select Report:</strong><br>
				<select name="select_report" tabindex=1>
					<option></option> <!-- Blank at top of list -->
				<?php
					if (db("exists", "SELECT count(*) FROM $reports", $link)) {
					 	$reportlist = db("statement", "SELECT code FROM $reports ORDER BY code", $link);
						$rownum = 0;
						while ($item = db("nextrow", $reportlist)) {
							if ($item["code"] == 'default') continue;
							print "\t<option>{$item["code"]}</option>\n";
						}
					}
				?>
				</select>
				<br>
				<input
					type="submit"
					name="action"
					value="Use Report"
					tabindex=1
				>
				&nbsp;&nbsp;&nbsp;
				<a href='<?php print "$self"; ?>?action=use+report&select_report=<?php print urlencode("$name"); ?>#report_help'
					tabindex=1
				>Help</a>
				<br>
				<span style="margin-top: 1ex; ">
<?php
	// only last set status message is printed, so most critical tests should be done last
	// If no other message, use default
	if (!isset($status)) {
	 	$status = "\t<font size='+2'>Editing . . .</font>\n";
	}
	print "<br><strong>$status</strong><BR>";
?>
				</span>
				<font size="+1"><strong>Report:&nbsp;</strong></font>
					<span class="report_code"><strong><?php print htmlspecialchars("$name", ENT_QUOTES); ?></strong></span>
				<input type="hidden" name="report" value="<?php print htmlspecialchars("$name", ENT_QUOTES); ?>">
				<br>
				<div style="margin-top: 1ex; ">
					<font size="+1">Description:</font><br>
					<textarea style="font-size: 100%;"
						rows=3
						wrap
						cols=25
						name="description"
						tabindex=1
					><?php if (isset($FWLOG["description"])) print htmlspecialchars("{$FWLOG["description"]}", ENT_QUOTES); ?></textarea>
					<input type="hidden" name="page" value="spec">
				</div>
				<div style="margin-top: 1ex; ">
				<table>
				<tr>
					<td>
						<input
							style="width: 16ex; "
							type="submit"
							name="action"
							value="Save"
							tabindex=1
						>
					</td>
					<td align="right">
						<input
							type="submit"
							name="action"
							value="Delete"
							tabindex=1
						>
					</td>
				</tr>
				<tr>
					<td>
						<input
							style="width: 16ex; "
							type="submit"
							name="action"
							value="Save as Default"
							tabindex=1
						>
					</td>
					<td>
						<input
							style="width: 16ex; "
							type="submit"
							name="action"
							value="Import"
							tabindex=1
						>
					</td>
				</tr>
				<tr>
					<td>
						<input
							style="width: 16ex; "
							type="submit"
							name="action"
							value="Create New"
							tabindex=1
						>
					</td>
					<td>
						<input
							style="width: 16ex; "
							type="submit"
							name="action"
							value="Export"
							tabindex=1
						>
					</td>
				</tr>
				</table>
				</div><hr>
			</td>          
		</tr>
		<tr>
			<td valign="top" colspan=2>
				<table>
					<caption ><strong>Report Options</strong>&nbsp;&nbsp;&nbsp;
						<a href='<?php print "$self"; ?>?action=use+report&select_report=<?php print urlencode("$name"); ?>#options_help'
							tabindex=1
						>Help</a>
					</caption>
					<col align="left">
					<col align="center">
					<tr class=opts>
						<td colspan="2">
						Select Data Source:<br>
							<input
								type="radio"
								name="data_source"
								value=""
								tabindex=1
								<?php if(!isset($FWLOG["data_source"])) print "checked\n"; ?>
							>
							&nbsp;Default
						</td>
					</tr>
					<tr class=opts>
						<td colspan="2">
							<input
								type="radio"
								name="data_source"
								value="db"
								tabindex=1
								<?php if(isset($FWLOG["data_source"]) and strtolower("{$FWLOG["data_source"]}") == "db") print "checked\n"; ?>
							>
							&nbsp;Database&nbsp;&nbsp;Table:&nbsp;
							<select name="data_tables[]" multiple size=3 tabindex=1>
								<option value="">Default</option>
								<?php
								$temp = array();
								if (isset($FWLOG["data_tables"]))
									$temp = array_flip($FWLOG["data_tables"]);
								if ("{$config["db"]}" <> "none")
									foreach(db("listtables","$data_d", $link) as $i) {
										print "<option";
										if (isset($temp["$i"])) print " selected";
										print ">".htmlspecialchars("{$i}", ENT_QUOTES)."</option>\n";
									}
								?>
							</select>
						</td>
					</tr>
					<tr class=opts>
						<td>
							<input
								type="radio"
								name="data_source"
								value="syslog"
								tabindex=1
								<?php if(isset($FWLOG["data_source"]) and strtolower("{$FWLOG["data_source"]}") == "syslog") print "checked\n"; ?>
							>
							&nbsp;Syslog&nbsp;Path:&nbsp;
						 	<?php print "{$config["syslog_dir"]}/"; ?><br>
							File(s)&nbsp;
							<input
								type="text"
								size="20"
								name="syslog_file"
								value="<?php if (isset($FWLOG["syslog_file"])) print htmlspecialchars("{$FWLOG["syslog_file"]}", ENT_QUOTES); ?>"
								tabindex=1
							>
							<hr>
						</td>
					</tr>
					<tr class=opts>
						<td colspan="2">Title (for heading of report)</td>
					</tr>
					<tr class=opts>
						<td colspan="2">
							<input
								style="width: 32ex"
								type="text"
								size="30"
								name="report_title"
								value="<?php if (isset($FWLOG["report_title"])) print htmlspecialchars("{$FWLOG["report_title"]}", ENT_QUOTES); ?>"
								tabindex=1
							>
						</td>
					</tr>
					<tr class=opts>
						<td>Rows per page</td>
						<td>
							<input
								style="width: 3em; vertical-align: middle; margin-left: .5ex;"
								type="text"
								size=4
								name="page_length"
								value="<?php if (isset($FWLOG["page_length"])) print htmlspecialchars("{$FWLOG["page_length"]}", ENT_QUOTES); ?>"
								tabindex=1
						>
						</td>
					</tr>
					<tr class=opts>
						<td>Page Refresh Rate</td>
						<td>
							<input
								style="width: 3em; vertical-align: middle; margin-left: .5ex;"
								type="text"
								size=4
								name="refresh"
								value="<?php if (isset($FWLOG["refresh"])) print htmlspecialchars("{$FWLOG["refresh"]}", ENT_QUOTES); ?>"
								tabindex=1
						>
						</td>
					</tr>
					<tr class=opts>
						<td>Update Hostname Cache</td>
						<td>
							<input
								type="checkbox"
								<?php if (isset($FWLOG["upd_hosts"]) and $FWLOG["upd_hosts"]) print "checked"; print "\n";?>
								name="upd_hosts"
								value="on"
								tabindex=1
							>
						</td>
					</tr>
					<tr class=opts>
						<td>Populate Hostname Cache</td>
						<td>
							<input
								type="checkbox"
								<?php if (isset($FWLOG["populate_cache"]) and $FWLOG["populate_cache"]) print "checked"; print "\n" ?>
								name="populate_cache"
								value="on"
								tabindex=1
							>
						</td>
					</tr>
					<tr class=opts>
						<td>Populate Cache Full</td>
						<td>
							<input
								type="checkbox"
								<?php if (isset($FWLOG["populate_cache_full"]) and $FWLOG["populate_cache_full"]) print "checked"; print "\n" ?>
								name="populate_cache_full"
								value="on"
								tabindex=1
							>
						</td>
					</tr>
					<?php if ($config["allow_be_verbose"]) { ?>
					<tr class=opts>
						<td>Be Verbose</td>
						<td>
							<input
								type="checkbox"
								<?php if (isset($FWLOG["be_verbose"]) and $FWLOG["be_verbose"]) print "checked"; print "\n";?>
								name="be_verbose"
								value="on"
								tabindex=1
						>
						</td>
					</tr>
					<?php } ?>
				</table>
			</td>
        </tr>
	</table>
	<hr>
	Update Hostname cache now.<br>
	This may take a LONG time.<br>
	<input
		style="width: 16ex; margin-top: .5ex; "
		type="submit"
		name="action"
		value="Update Cache"
		tabindex=1
	>
	</td> <!-- End of basic report info -->

	<td valign="top"> <!-- Sorting menu -->
	<table>
		<caption style="{font-size: 110%; font-weight: bold;}">
			<strong>SUMMARIZE REPORT:</strong>
				<input
					type="checkbox"
					name="summarize"
					value="on" 
					<?php if (isset($FWLOG["summarize"]) and $FWLOG["summarize"]) print "checked\n"; ?>
					tabindex=10
				>
		</caption>
	<thead>
		<tr>
			<th align="left" scope=col style="width: 10em">Sort by:</th>
			<th scope=col>Order</th>
			<th title="Check to sort in Decending order" scope=col>Desc</th>
		</tr>
	</thead>
	<tbody>
		<?php
			$numrows = 11;
			for ($i=1; $i<=$numrows; $i++) {
				$a = $sortorder[$i - 1];
				$t = substr("$a",2);
				$o = $a; $o[0] = "o";
				$l = $longnames["$t"];
		?> 
		<tr>
			<td ><?php print "{$longnames["$t"]}";?></td>
			<td align="center">
				<input
					type="text"
					class="num"
					size="3"
					maxlength="4"
					name="<?php print "$a"?>"
					value="<?php if (isset($FWLOG["$a"])) print htmlspecialchars("{$FWLOG["$a"]}", ENT_QUOTES)?>"
					tabindex=11
				>
			</td>
			<td align="center">
				<input
					type="checkbox"
					<?php if (isset($FWLOG["$o"]) and "{$FWLOG["$o"]}") print "checked\n"; ?>
					name="<?php print "$o"?>"
					value="on"
					tabindex=11
				>
			</td>
		</tr>
		<?php } ?>
		<tr>
			<td align="center">
				<a href="<?php print "$self"; ?>?action=use+report&select_report=<?php print urlencode("$name"); ?>#sort_help"
					tabindex=19
				>Help</a>
			</td>
			<td align="center" colspan="2">
				<input
					type="submit"
					name="sorting"
					value="More"
					tabindex=19
				>
			</td>
		</tr>
	</tbody>
	</table>
	<?php  // Add hidden controls for any sort keys not showing on main form
		$offset = $numrows;
		print "\n";
		while (isset($sortorder[$offset]) and isset($FWLOG["$sortorder[$offset]"])) {
			$a = $sortorder[$offset];
			$t = substr("$a",2);
			$o = $a; $o[0] = "o";
			print "\t<input type='hidden' name='{$sortorder[$offset]}' value='{$FWLOG["$sortorder[$offset]"]}'>\n";
			print "\t<input type='hidden' name='{$o}' value='{$FWLOG["$o"]}'>\n";
			$offset++;
		}
		print "\n";
	?>
	</td> <!-- Sorting menu -->

	<td valign="top"> <!-- Begin of Columns to include menu -->
	<table>
		<caption style="text-align: left; "><strong>Select columns to include in report and order:</strong></caption>
	  	<?php
		$numrows = 11;
		$numcols = 2;
		for ($a = 0; $a <= ($numcols - 1);  $a++) {
			print "<col><col align='center'><col>";
		}
		print "\n";
		print "<tr>";
		for ($a = 0; $a <= ($numcols - 1);  $a++) {
    		print "<th scope=col>Link</th><th scope=col>Order</th><th scope=col>Item</th>";
		}
		print "</tr>\n";
		for ($i = 0; $i <= ($numrows - 1);  $i++) {
			print "<tr>"; // row begin
			for ($j = 0; $j <= ($numcols - 1); $j++) {
				$colnum = $i + $j * $numrows ;
				if (!($a = $columnorder["$colnum"])) continue;
					$t = substr("$a",2);
					$l = $a; $l[0] = "l";
					$n = $longnames["$t"];
		?>
			<td align="center">
			<?php	switch ("$l") {
						case "l_oob_time_sec":
						case "l_oob_time_usec":// These never get
						case "l_dst_host":	   // links.
						case "l_src_host":	 
						case "l_dst_service":
						case "l_src_service":
						case "l_local_time":
						case "l_oob_earliest":
						case "l_oob_latest":
						case "l_earliest":
						case "l_latest":
							continue;
							break;
						default:
			?>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["$l"]) and "{$FWLOG["$l"]}") print "checked\n"; ?>
					name="<?php print "$l"?>"
					value="on"
					tabindex=<?php $tindex = $j + 20; print "$tindex"; ?>
				>
			<?php 			break;
					}
			?>
			</td>
			<td>
				<input
					type="text"
					class=num size="3"
					maxlength="4"
					name="<?php print "$a"?>"
					value="<?php if (isset($FWLOG["$a"])) print "{$FWLOG["$a"]}"?>"
					tabindex=<?php $tindex = $j + 20; print "$tindex"; ?>
				>
			</td>
<?php if ("$a" == "c_extra") { ?>
	<td>Grp:
		<input
			type="checkbox"<?php if (isset($FWLOG["g_extra"])) print " checked\n"; print "\n"; ?>
			name="<?php print "g_extra"?>"
			value="on"
			tabindex=<?php print "$j\n"; ?>
		>
		<input
			style="height: auto;"
			type="text"
			size=25
			name="c_extra_value"
			value="<?php  if (isset($FWLOG["c_extra_value"])) print htmlspecialchars("{$FWLOG["c_extra_value"]}", ENT_QUOTES); ?>"
			tabindex=<?php print "$tindex\n"; ?>
		>
	</td>
<?php
		$have_extra = 1;
	} else { ?>
			<td style="width: 10em"><?php print "$n";?></td>
<?php
	}
			}
			print "</tr>\n"; //row end
		}
		?>
		<tr><td></td><td></td>
		<td align="left" colspan=2>
			<input
				type="submit"
				name="selection"
				value="More"
				tabindex=20
			>
		</td>
		<td></td>
		<td>
			<a href='<?php print "$self"; ?>?action=use+report&select_report=<?php print urlencode("$name"); ?>#columns_help'
				tabindex=29
			>Help</a>
		</td>
		</tr>
	</table>
	<?php  // Add hidden controls for any columns not showing on main form
		$offset = $numcols * $numrows;
		print "\n";
		while (isset($columnorder[$offset]) and isset($FWLOG["$columnorder[$offset]"])) {
			$a = $columnorder[$offset];
			$l = $a; $l[0] = "l";
			print "\t<input type='hidden' name='$a' value='{$FWLOG["$columnorder[$offset]"]}'>\n";
			if (isset($FWLOG["$l"])) print "\t<input type='hidden' name='{$l}' value='{$FWLOG["$l"]}'>\n";
			$offset++;
		} 
		if (!isset($have_extra) and isset($FWLOG["c_extra_value"]) and $config["allow_raw_sql"]) {
 			print "\t<input type='hidden' name='c_extra_value' value='".htmlspecialchars("{$FWLOG["c_extra_value"]}", ENT_QUOTES)."'>\n";
			if (isset($FWLOG["g_extra"]))
				print "\t<input type='hidden' name='g_extra' value='{$FWLOG["g_extra"]}'>\n";
		}
		print "\n";
	?>
	</td> <!-- End of Columns to include menu -->
</tr> <!-- Emd of first row -->

<tr> <!-- Begin of Second row -->
	<td rowspan="1" colspan="2"> <!-- Begin Criteria Menu -->
	<table>
		<caption style="text-align: left; ">
			<strong>Selection Criteria:</strong>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<a href='<?php print "$self"; ?>?action=use+report&select_report=<?php print urlencode("$name"); ?>#crit_help'
				tabindex=30
			>Help</a>
		</caption>
		<colgroup>
			<col style="{width: 12.7em; }">
			<col style="{width: auto; }">
			<col align="center">
			<col style="padding-left: 1em;">
		</colgroup>
		<colgroup>
			<col style="{width: 11.7em; }">
			<col style="{width: auto; }">
			<col align="center">
		</colgroup>
	<thead>
		<tr><th scope=col>Item</th><th scope=col>Search Value</th><th scope=col>Inv</th><th scope=col></th>
			<th scope=col>Item</th><th scope=col>Search Value</th><th scope=col>Inv</th></tr>
	</thead>
	<tbody>
		<tr><td>Min date:&nbsp;&nbsp;&nbsp;oob time
				<input
					type="checkbox"
					name="w_oob_min_date"
					<?php if (isset($FWLOG["w_oob_min_date"]) and $FWLOG["w_oob_min_date"]) print "checked\n"; ?>
					value="on"
					tabindex=30
				>
			</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_min_date"
					value="<?php if (isset($FWLOG["w_min_date"])) print htmlspecialchars("{$FWLOG["w_min_date"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td></td>
			<td></td>
			<td>Max date:&nbsp;&nbsp;&nbsp;oob time
				<input
					type="checkbox"
					name="w_oob_max_date"
					<?php if (isset($FWLOG["w_oob_max_date"]) and $FWLOG["w_oob_max_date"]) print "checked\n"; ?>
					value="on"
					tabindex=31
				>
			</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_max_date"
					value="<?php if (isset($FWLOG["w_max_date"])) print htmlspecialchars("{$FWLOG["w_max_date"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td></td>
		</tr>
		<tr><td><?php print "{$longnames['local_hostname']}"?> (regexp):</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14 name="w_local_hostname"
					value="<?php if (isset($FWLOG["w_local_hostname"])) print htmlspecialchars("{$FWLOG["w_local_hostname"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_local_hostname"]) and $FWLOG["i_local_hostname"]) print "checked\n"; ?>
					name="i_local_hostname"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
			<td style="{width: auto; border: thin solid #D3D3D3; }" colspan="2" rowspan="4">
				<table>
				<tr class=opts><td colspan="3">TCP Options to include:</td></tr>
				<tr class=opts>  
				<td><span style="float:left;" class=opts>
					<input
						 class=opts
						 type="checkbox"
						 <?php if (isset($FWLOG["w_tcp_syn"]) and $FWLOG["w_tcp_syn"]) print "checked\n"; ?>
						 name="w_tcp_syn"
						 value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_syn</span>
				</td>
				<td><span style="float:left;" class=opts>
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_fin"]) and $FWLOG["w_tcp_fin"]) print "checked\n"; ?>
						name="w_tcp_fin"
						value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_fin</span>
				</td>
				<td><span style="float:left;" class=opts>
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_rst"]) and $FWLOG["w_tcp_rst"]) print "checked\n"; ?>
						name="w_tcp_rst"
						value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_rst</span>
				</td>
				</tr>
				<tr class=opts>
				<td><span style="float:left;" class=opts>
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_ack"]) and $FWLOG["w_tcp_ack"]) print "checked\n"; ?>
						name="w_tcp_ack"
						value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_ack</span>
				</td>
				<td><span style="float:left;" class=opts>
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_urg"]) and $FWLOG["w_tcp_urg"]) print "checked\n"; ?>
						name="w_tcp_urg"
						value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_urg</span>
				</td>
				<td><span style="float:left;" class=opts>
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_psh"]) and $FWLOG["w_tcp_psh"]) print "checked\n"; ?>
						name="w_tcp_psh"
						value="on"
						tabindex=31
					>
					</span>
					<span style="float:none;" class=opts>tcp_psh</span>
				</td>
				</tr>
				<tr class=opts>
				<td colspan="3" class=opts>
					TCP Options exact match:
					<input
						class=opts
						type="checkbox"
						<?php if (isset($FWLOG["w_tcp_options"]) and $FWLOG["w_tcp_options"]) print "checked\n"; ?>
						name="w_tcp_options"
						value="on"
						tabindex=31
					>
				</td>
				</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['oob_prefix']}"?> (regexp):</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_oob_prefix"
					value="<?php if (isset($FWLOG["w_oob_prefix"])) print htmlspecialchars("{$FWLOG["w_oob_prefix"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_oob_prefix"]) and $FWLOG["i_oob_prefix"]) print "checked\n"; ?>
					name="i_oob_prefix"
					value="on"
					tabindex=30
				>
			</td>
		</tr>
		<tr style="line-height: .1em;">
			<td style="font-size: xx-small">&nbsp;</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['ip_protocol']}"?> (name or number):</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_ip_protocol"
					value="<?php if (isset($FWLOG["w_ip_protocol"])) print htmlspecialchars("{$FWLOG["w_ip_protocol"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_ip_protocol"]) and $FWLOG["i_ip_protocol"]) print "checked\n"; ?>
					name="i_ip_protocol" value="on"
					tabindex=30
				>
			</td>
		</tr>
		<tr><td><?php print "{$longnames['tcp_sport']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_tcp_sport"
					value="<?php if (isset($FWLOG["w_tcp_sport"])) print htmlspecialchars("{$FWLOG["w_tcp_sport"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_tcp_sport"]) and $FWLOG["i_tcp_sport"]) print "checked\n"; ?>
					name="i_tcp_sport"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
			<td><?php print "{$longnames['tcp_dport']}"?>:</td>
			<td>
				<input style="height: auto;"
					type="text"
					size=14
					name="w_tcp_dport"
					value="<?php if (isset($FWLOG["w_tcp_dport"])) print htmlspecialchars("{$FWLOG["w_tcp_dport"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_tcp_dport"]) and $FWLOG["i_tcp_dport"]) print "checked\n"; ?>
					name="i_tcp_dport"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['udp_sport']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_udp_sport"
					value="<?php if (isset($FWLOG["w_udp_sport"])) print htmlspecialchars("{$FWLOG["w_udp_sport"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_udp_sport"]) and $FWLOG["i_udp_sport"]) print "checked\n"; ?>
					name="i_udp_sport"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
			<td><?php print "{$longnames['udp_dport']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_udp_dport"
					value="<?php if (isset($FWLOG["w_udp_dport"])) print htmlspecialchars("{$FWLOG["w_udp_dport"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_udp_dport"]) and $FWLOG["i_udp_dport"]) print "checked\n"; ?>
					name="i_udp_dport"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['icmp_type']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_icmp_type"
					value="<?php if (isset($FWLOG["w_icmp_type"])) print htmlspecialchars("{$FWLOG["w_icmp_type"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_icmp_type"]) and $FWLOG["i_icmp_type"]) print "checked\n"; ?>
					name="i_icmp_type"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
		    <td><?php print "{$longnames['icmp_code']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_icmp_code"
					value="<?php if (isset($FWLOG["w_icmp_code"])) print htmlspecialchars("{$FWLOG["w_icmp_code"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_icmp_code"]) and $FWLOG["i_icmp_code"]) print "checked\n"; ?>
					name="i_icmp_code"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['icmpv6_type']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_icmpv6_type"
					value="<?php if (isset($FWLOG["w_icmpv6_type"])) print htmlspecialchars("{$FWLOG["w_icmpv6_type"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_icmpv6_type"]) and $FWLOG["i_icmpv6_type"]) print "checked\n"; ?>
					name="i_icmpv6_type"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
		    <td><?php print "{$longnames['icmpv6_code']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_icmpv6_code"
					value="<?php if (isset($FWLOG["w_icmpv6_code"])) print htmlspecialchars("{$FWLOG["w_icmpv6_code"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_icmpv6_code"]) and $FWLOG["i_icmpv6_code"]) print "checked\n"; ?>
					name="i_icmpv6_code"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['ip_saddr']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_ip_saddr"
					value="<?php if (isset($FWLOG["w_ip_saddr"])) print htmlspecialchars("{$FWLOG["w_ip_saddr"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_ip_saddr"]) and $FWLOG["i_ip_saddr"]) print "checked\n"; ?>
					name="i_ip_saddr"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
			<td><?php print "{$longnames['ip_daddr']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_ip_daddr"
					value="<?php if (isset($FWLOG["w_ip_daddr"])) print htmlspecialchars("{$FWLOG["w_ip_daddr"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_ip_daddr"]) and $FWLOG["i_ip_daddr"]) print "checked\n"; ?>
					name="i_ip_daddr"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "{$longnames['oob_in']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_oob_in"
					value="<?php if (isset($FWLOG["w_oob_in"])) print htmlspecialchars("{$FWLOG["w_oob_in"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_oob_in"]) and $FWLOG["i_oob_in"]) print "checked\n"; ?>
					name="i_oob_in"
					value="on"
					tabindex=30
				>
			</td>
			<td></td>
			<td><?php print "{$longnames['oob_out']}"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_oob_out"
					value="<?php if (isset($FWLOG["w_oob_out"])) print htmlspecialchars("{$FWLOG["w_oob_out"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td>
				<input
					type="checkbox"
					<?php if (isset($FWLOG["i_oob_out"]) and $FWLOG["i_oob_out"]) print "checked\n"; ?>
					name="i_oob_out"
					value="on"
					tabindex=31
				>
			</td>
		</tr>
		<tr>
			<td><?php print "Minimum Count"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_min_count"
					value="<?php if (isset($FWLOG["w_min_count"])) print htmlspecialchars("{$FWLOG["w_min_count"]}", ENT_QUOTES); ?>"
					tabindex=30
				>
			</td>
			<td></td>
			<td></td>
			<td><?php print "Maximum Count"?>:</td>
			<td>
				<input
					style="height: auto;"
					type="text"
					size=14
					name="w_max_count"
					value="<?php if (isset($FWLOG["w_max_count"])) print htmlspecialchars("{$FWLOG["w_max_count"]}", ENT_QUOTES); ?>"
					tabindex=31
				>
			</td>
			<td></td>
		</tr>
		<tr>
		<td align="left" colspan=7>
			<br>
			<em>There may be additional criteria specified.  Press More to review.</em>&nbsp;
			<input
				type="submit"
				name="criteria"
				value="More"
				tabindex=30
			>
		</td>
		<td colspan=5></td>
		</tr>
	</tbody>
	</table>
	<?php  // Add hidden controls for any criteria not showing on main form
		print "\n";
		if (isset($FWLOG['w_min_latest'])) print "\t<input type='hidden' name='w_min_latest' value='".htmlspecialchars("{$FWLOG['w_min_latest']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_max_earliest'])) print "\t<input type='hidden' name='w_max_earliest' value='".htmlspecialchars("{$FWLOG['w_max_earliest']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_min_latest'])) print "\t<input type='hidden' name='w_oob_min_latest' value='".htmlspecialchars("{$FWLOG['w_oob_min_latest']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_max_earliest'])) print "\t<input type='hidden' name='w_oob_max_earliest' value='".htmlspecialchars("{$FWLOG['w_oob_max_earliest']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_family'])) print "\t<input type='hidden' name='w_oob_family' value='".htmlspecialchars("{$FWLOG['w_oob_family']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_oob_family'])) print "\t<input type='hidden' name='i_oob_family' value='".htmlspecialchars("{$FWLOG['i_oob_family']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_tos'])) print "\t<input type='hidden' name='w_ip_tos' value='".htmlspecialchars("{$FWLOG['w_ip_tos']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_tos'])) print "\t<input type='hidden' name='i_ip_tos' value='".htmlspecialchars("{$FWLOG['i_ip_tos']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_ttl'])) print "\t<input type='hidden' name='w_ip_ttl' value='".htmlspecialchars("{$FWLOG['w_ip_ttl']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_ttl'])) print "\t<input type='hidden' name='i_ip_ttl' value='".htmlspecialchars("{$FWLOG['i_ip_ttl']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_ihl'])) print "\t<input type='hidden' name='w_ip_ihl' value='".htmlspecialchars("{$FWLOG['w_ip_ihl']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_ihl'])) print "\t<input type='hidden' name='i_ip_ihl' value='".htmlspecialchars("{$FWLOG['i_ip_ihl']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_totlen'])) print "\t<input type='hidden' name='w_ip_totlen' value='".htmlspecialchars("{$FWLOG['w_ip_totlen']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_totlen'])) print "\t<input type='hidden' name='i_ip_totlen' value='".htmlspecialchars("{$FWLOG['i_ip_totlen']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_id'])) print "\t<input type='hidden' name='w_ip_id' value='".htmlspecialchars("{$FWLOG['w_ip_id']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_id'])) print "\t<input type='hidden' name='i_ip_id' value='".htmlspecialchars("{$FWLOG['i_ip_id']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_csum'])) print "\t<input type='hidden' name='w_ip_csum' value='".htmlspecialchars("{$FWLOG['w_ip_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_csum'])) print "\t<input type='hidden' name='i_ip_csum' value='".htmlspecialchars("{$FWLOG['i_ip_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip6_flowlabel'])) print "\t<input type='hidden' name='w_ip6_flowlabel' value='".htmlspecialchars("{$FWLOG['w_ip6_flowlabel']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip6_flowlabel'])) print "\t<input type='hidden' name='i_ip6_flowlabel' value='".htmlspecialchars("{$FWLOG['i_ip6_flowlabel']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip6_payloadlen'])) print "\t<input type='hidden' name='w_ip6_payloadlen' value='".htmlspecialchars("{$FWLOG['w_ip6_payloadlen']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip6_payloadlen'])) print "\t<input type='hidden' name='i_ip6_payloadlen' value='".htmlspecialchars("{$FWLOG['i_ip6_payloadlen']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_df'])) print "\t<input type='hidden' name='w_ip_df' value='".htmlspecialchars("{$FWLOG['w_ip_df']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_mf'])) print "\t<input type='hidden' name='w_ip_mf' value='".htmlspecialchars("{$FWLOG['w_ip_mf']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ip_fragoff'])) print "\t<input type='hidden' name='w_ip_fragoff' value='".htmlspecialchars("{$FWLOG['w_ip_fragoff']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ip_fragoff'])) print "\t<input type='hidden' name='i_ip_fragoff' value='".htmlspecialchars("{$FWLOG['i_ip_fragoff']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_seq'])) print "\t<input type='hidden' name='w_tcp_seq' value='".htmlspecialchars("{$FWLOG['w_tcp_seq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_seq'])) print "\t<input type='hidden' name='i_tcp_seq' value='".htmlspecialchars("{$FWLOG['i_tcp_seq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_ackseq'])) print "\t<input type='hidden' name='w_tcp_ackseq' value='".htmlspecialchars("{$FWLOG['w_tcp_ackseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_ackseq'])) print "\t<input type='hidden' name='i_tcp_ackseq' value='".htmlspecialchars("{$FWLOG['i_tcp_ackseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_window'])) print "\t<input type='hidden' name='w_tcp_window' value='".htmlspecialchars("{$FWLOG['w_tcp_window']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_window'])) print "\t<input type='hidden' name='i_tcp_window' value='".htmlspecialchars("{$FWLOG['i_tcp_window']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_urgp'])) print "\t<input type='hidden' name='w_tcp_urgp' value='".htmlspecialchars("{$FWLOG['w_tcp_urgp']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_urgp'])) print "\t<input type='hidden' name='i_tcp_urgp' value='".htmlspecialchars("{$FWLOG['i_tcp_urgp']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_off'])) print "\t<input type='hidden' name='w_tcp_off' value='".htmlspecialchars("{$FWLOG['w_tcp_off']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_off'])) print "\t<input type='hidden' name='i_tcp_off' value='".htmlspecialchars("{$FWLOG['i_tcp_off']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_tcp_csum'])) print "\t<input type='hidden' name='w_tcp_csum' value='".htmlspecialchars("{$FWLOG['w_tcp_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_tcp_csum'])) print "\t<input type='hidden' name='i_tcp_csum' value='".htmlspecialchars("{$FWLOG['i_tcp_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmp_echoid'])) print "\t<input type='hidden' name='w_icmp_echoid' value='".htmlspecialchars("{$FWLOG['w_icmp_echoid']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmp_echoid'])) print "\t<input type='hidden' name='i_icmp_echoid' value='".htmlspecialchars("{$FWLOG['i_icmp_echoid']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmp_echoseq'])) print "\t<input type='hidden' name='w_icmp_echoseq' value='".htmlspecialchars("{$FWLOG['w_icmp_echoseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmp_echoseq'])) print "\t<input type='hidden' name='i_icmp_echoseq' value='".htmlspecialchars("{$FWLOG['i_icmp_echoseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmp_gateway'])) print "\t<input type='hidden' name='w_icmp_gateway' value='".htmlspecialchars("{$FWLOG['w_icmp_gateway']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmp_gateway'])) print "\t<input type='hidden' name='i_icmp_gateway' value='".htmlspecialchars("{$FWLOG['i_icmp_gateway']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmp_fragmtu'])) print "\t<input type='hidden' name='w_icmp_fragmtu' value='".htmlspecialchars("{$FWLOG['w_icmp_fragmtu']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmp_fragmtu'])) print "\t<input type='hidden' name='i_icmp_fragmtu' value='".htmlspecialchars("{$FWLOG['i_icmp_fragmtu']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmpv6_echoid'])) print "\t<input type='hidden' name='w_icmpv6_echoid' value='".htmlspecialchars("{$FWLOG['w_icmpv6_echoid']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmpv6_echoid'])) print "\t<input type='hidden' name='i_icmpv6_echoid' value='".htmlspecialchars("{$FWLOG['i_icmpv6_echoid']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_icmpv6_echoseq'])) print "\t<input type='hidden' name='w_icmpv6_echoseq' value='".htmlspecialchars("{$FWLOG['w_icmpv6_echoseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_icmpv6_echoseq'])) print "\t<input type='hidden' name='i_icmpv6_echoseq' value='".htmlspecialchars("{$FWLOG['i_icmpv6_echoseq']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_udp_len'])) print "\t<input type='hidden' name='w_udp_len' value='".htmlspecialchars("{$FWLOG['w_udp_len']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_udp_len'])) print "\t<input type='hidden' name='i_udp_len' value='".htmlspecialchars("{$FWLOG['i_udp_len']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_udp_csum'])) print "\t<input type='hidden' name='w_udp_csum' value='".htmlspecialchars("{$FWLOG['w_udp_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_udp_csum'])) print "\t<input type='hidden' name='i_udp_csum' value='".htmlspecialchars("{$FWLOG['i_udp_csum']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_raw_type'])) print "\t<input type='hidden' name='w_raw_type' value='".htmlspecialchars("{$FWLOG['w_raw_type']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_raw_type'])) print "\t<input type='hidden' name='i_raw_type' value='".htmlspecialchars("{$FWLOG['i_raw_type']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_protocol'])) print "\t<input type='hidden' name='w_oob_protocol' value='".htmlspecialchars("{$FWLOG['w_oob_protocol']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_oob_protocol'])) print "\t<input type='hidden' name='i_oob_protocol' value='".htmlspecialchars("{$FWLOG['i_oob_protocol']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_mac_saddr_str'])) print "\t<input type='hidden' name='w_mac_saddr_str' value='".htmlspecialchars("{$FWLOG['w_mac_saddr_str']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_mac_saddr_str'])) print "\t<input type='hidden' name='i_mac_saddr_str' value='".htmlspecialchars("{$FWLOG['i_mac_saddr_str']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_mac_daddr_str'])) print "\t<input type='hidden' name='w_mac_daddr_str' value='".htmlspecialchars("{$FWLOG['w_mac_daddr_str']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_mac_daddr_str'])) print "\t<input type='hidden' name='i_mac_daddr_str' value='".htmlspecialchars("{$FWLOG['i_mac_daddr_str']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_raw_mac'])) print "\t<input type='hidden' name='w_raw_mac' value='".htmlspecialchars("{$FWLOG['w_raw_mac']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_raw_mac'])) print "\t<input type='hidden' name='i_raw_mac' value='".htmlspecialchars("{$FWLOG['i_raw_mac']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_hook'])) print "\t<input type='hidden' name='w_oob_hook' value='".htmlspecialchars("{$FWLOG['w_oob_hook']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_oob_hook'])) print "\t<input type='hidden' name='i_oob_hook' value='".htmlspecialchars("{$FWLOG['i_oob_hook']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_mark'])) print "\t<input type='hidden' name='w_oob_mark' value='".htmlspecialchars("{$FWLOG['w_oob_mark']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_oob_mark'])) print "\t<input type='hidden' name='i_oob_mark' value='".htmlspecialchars("{$FWLOG['i_oob_mark']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_ahesp_spi'])) print "\t<input type='hidden' name='w_ahesp_spi' value='".htmlspecialchars("{$FWLOG['w_ahesp_spi']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_ahesp_spi'])) print "\t<input type='hidden' name='i_ahesp_spi' value='".htmlspecialchars("{$FWLOG['i_ahesp_spi']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_oob_time_usec'])) print "\t<input type='hidden' name='w_oob_time_usec' value='".htmlspecialchars("{$FWLOG['w_oob_time_usec']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_oob_time_usec'])) print "\t<input type='hidden' name='i_oob_time_usec' value='".htmlspecialchars("{$FWLOG['i_oob_time_usec']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_pwsniff_user'])) print "\t<input type='hidden' name='w_pwsniff_user' value='".htmlspecialchars("{$FWLOG['w_pwsniff_user']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_pwsniff_user'])) print "\t<input type='hidden' name='i_pwsniff_user' value='".htmlspecialchars("{$FWLOG['i_pwsniff_user']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_pwsniff_pass'])) print "\t<input type='hidden' name='w_pwsniff_pass' value='".htmlspecialchars("{$FWLOG['w_pwsniff_pass']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['i_pwsniff_pass'])) print "\t<input type='hidden' name='i_pwsniff_pass' value='".htmlspecialchars("{$FWLOG['i_pwsniff_pass']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['w_extra']) and $config["allow_raw_sql"]) print "\t<input type='hidden' name='w_extra' value='".htmlspecialchars("{$FWLOG['w_extra']}", ENT_QUOTES)."'>\n";
		if (isset($FWLOG['h_extra']) and $config["allow_raw_sql"]) print "\t<input type='hidden' name='h_extra' value='".htmlspecialchars("{$FWLOG['h_extra']}", ENT_QUOTES)."'>\n";
		print "\n";
	?>
	</td> <!-- End of Criteria Menu -->
</tr> <!-- End of Second row -->
</table> <!-- End of Main Table -->

</form> <!-- End of Form -->
</td>
</tr>
<?php
	db("close", $link);
	$doc_page = "editor";
	include "include/edit_doc.php";
?>
</table>

</body>
</html>

<!-- vim:set ts=4: -->
