diff --git a/inc/config.php b/inc/config.php index b69806cb..05e90f1d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -308,9 +308,17 @@ 'json_response', 'user_flag', 'no_country', - 'tag' + 'tag', + 'simple_spam' ); + // 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 7996cedb..b092a20e 100644 --- a/post.php +++ b/post.php @@ -483,6 +483,12 @@ function handle_post(){ } } + if (isset($config['simple_spam']) && $post['op']) { + if(!isset($_POST['simple_spam']) || $config['simple_spam']['answer'] != $_POST['simple_spam']){ + error($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 ef51094e..dc8af008 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -213,6 +213,16 @@ {{ antibot.html() }} {% endif %} + {% if config.simple_spam and not id %} + + {{ config.simple_spam.prompt }} + {{ antibot.html() }} + + + + {{ antibot.html() }} + + {% endif %} {{ antibot.html(true) }}