Revert "anti-bot.php: permanent bans stay permanent on new bans being issued"

This reverts commit 684a3cb852.
This commit is contained in:
Zankaria 2024-07-10 00:26:27 +02:00
parent 684a3cb852
commit 35388a942e

View file

@ -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);