if this->count is checked inside event->pri, then checking again for count *is* necessary...

This commit is contained in:
Shish 2012-03-19 22:25:57 +00:00
parent e4e95a3a85
commit 033540e6f8

View File

@ -14,14 +14,14 @@ class LogNet extends Extension {
global $user; global $user;
if($event->priority > 10) { if($event->priority > 10) {
$this->count++;
if($this->count < 10) { if($this->count < 10) {
// TODO: colour based on event->priority // TODO: colour based on event->priority
$username = ($user && $user->name) ? $user->name : "Anonymous"; $username = ($user && $user->name) ? $user->name : "Anonymous";
$str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message); $str = sprintf("%-15s %-10s: %s", $_SERVER['REMOTE_ADDR'], $username, $event->message);
system("echo ".escapeshellarg($str)." | nc -q 0 localhost 5000"); 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"); system("echo 'suppressing flood, check the web log' | nc -q 0 localhost 5000");
} }
} }