diff --git a/inc/config.php b/inc/config.php index b69806cb..6ede0332 100644 --- a/inc/config.php +++ b/inc/config.php @@ -308,9 +308,16 @@ 'json_response', 'user_flag', 'no_country', - 'tag' + 'tag', + 'simple_spam' ); + // Enable simple anti-spam measure. + $config['simple_spam'] = array ( + 'question' => '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 7996cedb..4a46d4d0 100644 --- a/post.php +++ b/post.php @@ -483,6 +483,12 @@ 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['securimage']) && $config['securimage']){ if(!isset($_POST['captcha'])){ diff --git a/templates/post_form.html b/templates/post_form.html index 02c6087f..202ba906 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -213,6 +213,16 @@ {{ antibot.html() }} {% endif %} + {% if config.simple_anti_spam and not id %} + + {{ config.simple_anti_spam.prompt }} + {{ antibot.html() }} + + + + {{ antibot.html() }} + + {% endif %} {{ antibot.html(true) }}