diff --git a/inc/anti-bot.php b/inc/anti-bot.php index 15a2954e..90259e8d 100644 --- a/inc/anti-bot.php +++ b/inc/anti-bot.php @@ -191,7 +191,7 @@ class AntiBot { } function _create_antibot($board, $thread) { - global $purged_old_antispam; + global $config, $purged_old_antispam; $antibot = new AntiBot(array($board, $thread)); @@ -200,6 +200,17 @@ function _create_antibot($board, $thread) { query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); } + if ($thread) + $query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL'); + else + $query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` IS NULL AND `expires` IS NULL'); + + $query->bindValue(':board', $board); + if ($thread) + $query->bindValue(':thread', $thread); + $query->bindValue(':expires', $config['spam']['hidden_inputs_expire']); + $query->execute() or error(db_error($query)); + $query = prepare('INSERT INTO ``antispam`` VALUES (:board, :thread, :hash, UNIX_TIMESTAMP(), NULL, 0)'); $query->bindValue(':board', $board); $query->bindValue(':thread', $thread);