From ef01eef2a2f78ab15a72a356c955c7a1b1956821 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sat, 15 Jun 2024 20:29:25 -0400 Subject: [PATCH] Enable anti-bot, except for the case where the hash is missing from the db (most bots don't seem to be that smart) --- inc/anti-bot.php | 12 +++++++++--- post.php | 2 -- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/anti-bot.php b/inc/anti-bot.php index c2d659cf..faa34ee0 100644 --- a/inc/anti-bot.php +++ b/inc/anti-bot.php @@ -258,7 +258,7 @@ function _create_antibot($board, $thread) { $query->bindValue(':hash', $antibot->hash()); $query->execute() or error(db_error($query)); - $antibot->printErrVars(); + //$antibot->printErrVars(); return $antibot; } @@ -266,7 +266,12 @@ function _create_antibot($board, $thread) { function dumpVars($extra_salt) { global $config; - print_err("Check Spam POST data: " . json_encode($_POST)); + $json_repr = json_encode($_POST); + print_err("Check Spam POST data: " . $json_repr); + + if ($json_repr === false) { + print_err("Could not jsonify POST data: " . json_last_error_message()); + } /* foreach ($_POST as $name => $value) { @@ -344,7 +349,8 @@ function checkSpam(array $extra_salt = array()) { // there was no database entry for this hash. most likely expired. print_err("checkSpam: there was no database entry for this hash. most likely expired. $hash"); dumpVars($extra_salt_orig); - return true; + return $hash; // do not consider this a failure case. (I would rather a spam post than a false-positive tbqh) + //return true; } return $hash; diff --git a/post.php b/post.php index 2017746f..22932166 100644 --- a/post.php +++ b/post.php @@ -579,11 +579,9 @@ function handle_post(){ ); //$post['antispam_hash'] = checkSpam(); - /* if ($post['antispam_hash'] === true) { error($config['error']['spam']); } - */ } if ($config['robot_enable'] && $config['robot_mute']) {