From 90763c7fabf9dbcba50dcb15748c7c6d5dc148ec Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Mon, 1 Oct 2012 14:36:40 +0200 Subject: Firewall log, allow filtering by interface. --- usr/local/www/diag_logs_filter.php | 76 +++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 26 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index 193585a..6fd8f24 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -46,37 +46,26 @@ require("guiconfig.inc"); require_once("filter_log.inc"); -if($_GET['getrulenum'] or $_POST['getrulenum']) { - if($_GET['getrulenum']) - $rulenum = $_GET['getrulenum']; - if($_POST['getrulenum']) - $rulenum = $_POST['getrulenum']; +function getGETPOSTsettingvalue($settingname, $default) +{ + $settingvalue = $default; + if($_GET[$settingname]) + $settingvalue = $_GET[$settingname]; + if($_POST[$settingname]) + $settingvalue = $_POST[$settingname]; + return $settingvalue; +} + +$rulenum = getGETPOSTsettingvalue('getrulenum', null); +if($rulenum) { list($rulenum, $type) = explode(',', $rulenum); $rule = find_rule_by_number($rulenum, $type); echo gettext("The rule that triggered this action is") . ":\n\n{$rule}"; exit; } -if($_GET['dnsip'] or $_POST['dnsip']) { - if($_GET['dnsip']) - $dnsip = $_GET['dnsip']; - if($_POST['dnsip']) - $dnsip = $_POST['dnsip']; - $host = get_reverse_dns($dnsip); - if ($host == $ip) { - $host = "No PTR Record"; - } - echo "IP: {$dnsip}\nHost: {$host}"; - exit; -} - -$filtertext = ""; -if($_GET['filtertext'] or $_POST['filtertext']) { - if($_GET['filtertext']) - $filtertext = htmlspecialchars($_GET['filtertext']); - if($_POST['filtertext']) - $filtertext = htmlspecialchars($_POST['filtertext']); -} +$interfacefilter = getGETPOSTsettingvalue('interface', null); +$filtertext = htmlspecialchars(getGETPOSTsettingvalue('filtertext', "")); $filter_logfile = "{$g['varlog_path']}/filter.log"; @@ -122,6 +111,38 @@ include("head.inc");
+ + " />
@@ -138,7 +159,10 @@ include("head.inc"); " class="listtopic"> -- cgit v1.1