Fixed issue #26 (text-based flood filter should not include blank posts)
This commit is contained in:
parent
7b35f25dcd
commit
3733162e0a
@ -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,11 +906,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if($query->fetch()) {
|
if($query->fetch()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -1540,4 +1543,5 @@
|
|||||||
file_unlink($post['thumb']);
|
file_unlink($post['thumb']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user