summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-03-27 20:38:11 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2011-03-27 20:38:11 +1100
commit7c2938b542cfdc91b93cf549efe50804c7d1c181 (patch)
tree4794f1c9bcfb9b0dbf88860ad6f3c29e80ddd30f
parentb08751f56288addc70c2e7c3af537664ad3aa7ab (diff)
Fixed a small bug on the flood filter
-rw-r--r--inc/config.php44
-rw-r--r--post.php13
2 files changed, 29 insertions, 28 deletions
diff --git a/inc/config.php b/inc/config.php
index 179eff32..63e42c39 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -19,7 +19,8 @@
'error' => Array(),
'dir' => Array(),
'mod' => Array(),
- 'spam' => Array()
+ 'spam' => Array(),
+ 'flood_filters' => Array()
);
// Database stuff
@@ -378,28 +379,27 @@
);
// Custom flood filters. Detect flood attacks and reject new posts if there's a positive match.
- //$config['flood_filters'] = Array(
- // Array(
- // 'condition' => Array(
- // // 100 posts in the past 5 minutes (~20 p/m)
- // 'posts_in_past_x_minutes' => Array(100, 5)
- // ),
- // // Don't allow the user to post
- // 'action' => 'reject',
- // // Display this message
- // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board.'
+ //$config['flood_filters'][] = Array(
+ // 'condition' => Array(
+ // // 100 posts in the past 5 minutes (~20 p/m)
+ // 'posts_in_past_x_minutes' => Array(100, 5)
// ),
- // // Another filter
- // Array(
- // 'condition' => Array(
- // // 10 new empty threads in the past 2 minutes
- // 'threads_with_no_replies_in_past_x_minutes' => Array(10, 2),
- // // Allow replies, but not new threads (ie. reject topics only).
- // 'OP' => true
- // ),
- // 'action' => 'reject',
- // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board (too many new threads); post a reply instead.'
- // )
+ // // Don't allow the user to post
+ // 'action' => 'reject',
+ // // Display this message
+ // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board.'
+ //);
+
+ // Another filter
+ //$config['flood_filters'][] = Array(
+ // 'condition' => Array(
+ // // 10 new empty threads in the past 2 minutes
+ // 'threads_with_no_replies_in_past_x_minutes' => Array(10, 2),
+ // // Allow replies, but not new threads (ie. reject topics only).
+ // 'OP' => true
+ // ),
+ // 'action' => 'reject',
+ // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board (too many new threads); post a reply instead.'
//);
// A small file in the main directory indicating that the script has been ran and the board(s) have been generated.
diff --git a/post.php b/post.php
index 28e0eb2e..4dd8cc6e 100644
--- a/post.php
+++ b/post.php
@@ -303,6 +303,7 @@
// Custom anti-spam filters
if(isset($config['flood_filters'])) {
foreach($config['flood_filters'] as &$filter) {
+ unset($did_not_match);
// Set up default stuff
if(!isset($filter['action']))
$filter['action'] = 'reject';
@@ -333,7 +334,7 @@
}
} elseif($condition == 'OP') {
// Am I OP?
- if($OP)
+ if($value == $OP)
continue;
} else {
// Unknown block
@@ -343,11 +344,11 @@
$did_not_match = true;
break;
}
- if(!isset($did_not_match)) {
- // Matched filter!
- if($filter['action'] == 'reject') {
- error($filter['message']);
- }
+ }
+ if(!isset($did_not_match)) {
+ // Matched filter!
+ if($filter['action'] == 'reject') {
+ error($filter['message']);
}
}
}