From 033540e6f89acbf51b46badc4ce6bec7b3a56b81 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 19 Mar 2012 22:25:57 +0000 Subject: [PATCH] if this->count is checked inside event->pri, then checking again for count *is* necessary... --- contrib/log_net/main.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/log_net/main.php b/contrib/log_net/main.php index 4cde7c56..94d9d94c 100644 --- a/contrib/log_net/main.php +++ b/contrib/log_net/main.php @@ -14,14 +14,14 @@ class LogNet extends Extension { global $user; if($event->priority > 10) { + $this->count++; if($this->count < 10) { // TODO: colour based on event->priority $username = ($user && $user->name) ? $user->name : "Anonymous"; $str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message); system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); - $this->count++; } - else { + else if($this->count == 10) { system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000"); } }