Fixed issue #26 (text-based flood filter should not include blank posts)

This commit is contained in:
Savetheinternet 2011-11-16 19:59:21 +11:00
parent 7b35f25dcd
commit 3733162e0a

View File

@ -384,7 +384,7 @@
function checkFlood($post) { function checkFlood($post) {
global $board, $config; 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(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':body', $post['body'], PDO::PARAM_INT); $query->bindValue(':body', $post['body'], PDO::PARAM_INT);
$query->bindValue(':floodtime', time()-$config['flood_time'], PDO::PARAM_INT); $query->bindValue(':floodtime', time()-$config['flood_time'], PDO::PARAM_INT);
@ -906,6 +906,9 @@
} }
function checkRobot($body) { function checkRobot($body) {
if(empty($body))
return true;
$body = makerobot($body); $body = makerobot($body);
$query = prepare("SELECT 1 FROM `robot` WHERE `hash` = :hash LIMIT 1"); $query = prepare("SELECT 1 FROM `robot` WHERE `hash` = :hash LIMIT 1");
$query->bindValue(':hash', $body); $query->bindValue(':hash', $body);
@ -1540,4 +1543,5 @@
file_unlink($post['thumb']); file_unlink($post['thumb']);
} }
} }
?> ?>