From 56bbaf881f65a1bf5fce84f1a92d538cf2ea1eae 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 a64f9ad8..05e90f1d 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 4a46d4d0..b092a20e 100644 --- a/post.php +++ b/post.php @@ -483,9 +483,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']); } }