Enable anti-bot, except for the case where the hash is missing from the db (most bots don't seem to be that smart)

This commit is contained in:
towards-a-new-leftypol 2024-06-15 20:29:25 -04:00
parent 4349499ddd
commit ef01eef2a2
2 changed files with 9 additions and 5 deletions

View File

@ -258,7 +258,7 @@ function _create_antibot($board, $thread) {
$query->bindValue(':hash', $antibot->hash()); $query->bindValue(':hash', $antibot->hash());
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
$antibot->printErrVars(); //$antibot->printErrVars();
return $antibot; return $antibot;
} }
@ -266,7 +266,12 @@ function _create_antibot($board, $thread) {
function dumpVars($extra_salt) { function dumpVars($extra_salt) {
global $config; 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) { 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. // 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"); print_err("checkSpam: there was no database entry for this hash. most likely expired. $hash");
dumpVars($extra_salt_orig); 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; return $hash;

View File

@ -579,11 +579,9 @@ function handle_post(){
); );
//$post['antispam_hash'] = checkSpam(); //$post['antispam_hash'] = checkSpam();
/*
if ($post['antispam_hash'] === true) { if ($post['antispam_hash'] === true) {
error($config['error']['spam']); error($config['error']['spam']);
} }
*/
} }
if ($config['robot_enable'] && $config['robot_mute']) { if ($config['robot_enable'] && $config['robot_mute']) {