forked from leftypol/leftypol
anti-bot.php: add comments to _create_antibot
This commit is contained in:
parent
35388a942e
commit
4e7f53216d
1 changed files with 5 additions and 0 deletions
|
@ -195,11 +195,15 @@ function _create_antibot($board, $thread) {
|
||||||
|
|
||||||
$antibot = new AntiBot(array($board, $thread));
|
$antibot = new AntiBot(array($board, $thread));
|
||||||
|
|
||||||
|
// Delete old expired antispam, skipping those with NULL expiration timestamps (infinite lifetime).
|
||||||
if (!isset($purged_old_antispam)) {
|
if (!isset($purged_old_antispam)) {
|
||||||
$purged_old_antispam = true;
|
$purged_old_antispam = true;
|
||||||
query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error());
|
query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the now invalid timestamps around for a bit to enable users to post if they're still on an old version of
|
||||||
|
// the HTML page.
|
||||||
|
// By virtue of existing, we know that we're making a new version of the page, and the user from now on may just reload.
|
||||||
if ($thread)
|
if ($thread)
|
||||||
$query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL');
|
$query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL');
|
||||||
else
|
else
|
||||||
|
@ -211,6 +215,7 @@ function _create_antibot($board, $thread) {
|
||||||
$query->bindValue(':expires', $config['spam']['hidden_inputs_expire']);
|
$query->bindValue(':expires', $config['spam']['hidden_inputs_expire']);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
|
// Insert an antispam with infinite life as the HTML page of a thread might last well beyond the expiry date.
|
||||||
$query = prepare('INSERT INTO ``antispam`` VALUES (:board, :thread, :hash, UNIX_TIMESTAMP(), NULL, 0)');
|
$query = prepare('INSERT INTO ``antispam`` VALUES (:board, :thread, :hash, UNIX_TIMESTAMP(), NULL, 0)');
|
||||||
$query->bindValue(':board', $board);
|
$query->bindValue(':board', $board);
|
||||||
$query->bindValue(':thread', $thread);
|
$query->bindValue(':thread', $thread);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue