From 1ba738af6a6a20db1c0a56ffbd2de57914747984 Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sun, 11 Sep 2005 22:18:05 +0000 Subject: A few more minor bugfixes. --- packages/arpwatch_reports.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'packages/arpwatch_reports.php') diff --git a/packages/arpwatch_reports.php b/packages/arpwatch_reports.php index 709035ea..b39fb9fb 100755 --- a/packages/arpwatch_reports.php +++ b/packages/arpwatch_reports.php @@ -36,17 +36,20 @@ $logfile = "/usr/local/arpwatch/arp.dat"; if ($_POST['clear']) { stop_service("arpwatch"); unlink_if_exists($logfile); + touch($logfile); start_service("arpwatch"); } -$rawrep = file($logfile); -foreach($rawrep as $line) { - $todo = preg_split('/\s/', $line); - $report[$todo[1]][] = array( - "mac" => trim($todo[0]), - "timestamp" => trim($todo[2]), - "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown" - ); +if(file_exists($logfile)) { + $rawrep = file($logfile); + foreach($rawrep as $line) { + $todo = preg_split('/\s/', $line); + $report[$todo[1]][] = array( + "mac" => trim($todo[0]), + "timestamp" => trim($todo[2]), + "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown" + ); + } } $pgtitle = "arpwatch: Reports"; include("head.inc"); @@ -108,7 +111,7 @@ include("head.inc");
-
+
-- cgit v1.2.3