From c7528b49b45ce2b93b6935bafe2912f0fdd10971 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 11 Sep 2023 01:17:39 +0200 Subject: [PATCH] Simple anti-spam mechanism --- inc/config.php | 3 ++- post.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/config.php b/inc/config.php index 3f78e6d5..9e83d5b8 100644 --- a/inc/config.php +++ b/inc/config.php @@ -313,11 +313,12 @@ ); // Enable simple anti-spam measure. + /* $config['simple_spam'] = array ( 'prompt' => 'What is 2 + 2?', 'answer' => '4' ); - + */ // Enable reCaptcha to make spam even harder. Rarely necessary. $config['recaptcha'] = false; diff --git a/post.php b/post.php index 0cdff6b9..8a6b155b 100644 --- a/post.php +++ b/post.php @@ -478,9 +478,9 @@ function handle_post(){ } } - if ($config['simple_spam'] && $post['op']) { - if(!isset($_POST['simple_spam']) || $config['simple_spam']['answer'] != $_POST['simple_spam'])){ - $config['error']['spam']; + if (isset($config['simple_spam']) && $post['op']) { + if(!isset($_POST['simple_spam']) || $config['simple_spam']['answer'] != $_POST['simple_spam']){ + error($config['error']['spam']); } }