summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-05-07 23:51:15 +1000
committerMichael Save <savetheinternet@tinyboard.org>2012-05-07 23:51:58 +1000
commitad220b725d6411657d62f081885891d394baaf4d (patch)
treef6a5e08932b70479f1308021b2d69e4b5fba0b85 /inc
parent46f7ec1a943dceb584dacb7e55c032fc813888e7 (diff)
Bugfix: the number of successful passes for an anti-spam "hash" was often incorrectly incremented
Diffstat (limited to 'inc')
-rw-r--r--inc/anti-bot.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/inc/anti-bot.php b/inc/anti-bot.php
index 9e3ffeb2..81afca1b 100644
--- a/inc/anti-bot.php
+++ b/inc/anti-bot.php
@@ -243,22 +243,24 @@ function checkSpam(array $extra_salt = array()) {
if ($hash != $_hash)
return true;
- $query = prepare('UPDATE `antispam` SET `passed` = `passed` + 1 WHERE `hash` = :hash');
+ $query = prepare('SELECT `passed` FROM `antispam` WHERE `hash` = :hash');
$query->bindValue(':hash', $hash);
$query->execute() or error(db_error($query));
- if ($query->rowCount() == 0) {
+ if (($passed = $query->fetchColumn(0)) === false) {
// there was no database entry for this hash. most likely expired.
return true;
}
- $query = prepare('SELECT `passed` FROM `antispam` WHERE `hash` = :hash');
- $query->bindValue(':hash', $hash);
- $query->execute() or error(db_error($query));
- $passed = $query->fetchColumn(0);
-
if ($passed > $config['spam']['hidden_inputs_max_pass'])
return true;
- return false;
+ return $hash;
}
+function incrementSpamHash($hash) {
+ $query = prepare('UPDATE `antispam` SET `passed` = `passed` + 1 WHERE `hash` = :hash');
+ $query->bindValue(':hash', $hash);
+ $query->execute() or error(db_error($query));
+}
+
+