diff options
| author | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-16 19:59:21 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@tinyboard.org> | 2011-11-16 19:59:21 +1100 |
| commit | 3733162e0a66fdb8569471df1fa4cf377da26594 (patch) | |
| tree | 6245c259efb61c91d8820cfa596ecb2123a7319a /inc | |
| parent | 7b35f25dcdb1195c595d840976fdb74dd3b35301 (diff) | |
Fixed issue #26 (text-based flood filter should not include blank posts)
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/functions.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/inc/functions.php b/inc/functions.php index a88399f3..496de972 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -384,7 +384,7 @@ function checkFlood($post) { global $board, $config; - $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`ip` = :ip AND `time` >= :floodtime) OR (`ip` = :ip AND `body` = :body AND `time` >= :floodsameiptime) OR (`body` = :body AND `time` >= :floodsametime) LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`ip` = :ip AND `time` >= :floodtime) OR (`ip` = :ip AND `body` != '' AND `body` = :body AND `time` >= :floodsameiptime) OR (`body` != '' AND `body` = :body AND `time` >= :floodsametime) LIMIT 1", $board['uri'])); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->bindValue(':body', $post['body'], PDO::PARAM_INT); $query->bindValue(':floodtime', time()-$config['flood_time'], PDO::PARAM_INT); @@ -906,11 +906,14 @@ } function checkRobot($body) { + if(empty($body)) + return true; + $body = makerobot($body); $query = prepare("SELECT 1 FROM `robot` WHERE `hash` = :hash LIMIT 1"); $query->bindValue(':hash', $body); $query->execute() or error(db_error($query)); - + if($query->fetch()) { return true; } else { @@ -1540,4 +1543,5 @@ file_unlink($post['thumb']); } } + ?> |
