Simple anti-spam mechanism with question and answer for thread creation. #75

Merged
nonmakina merged 5 commits from anti/spam into config 8 months ago
  1. 10
      inc/config.php
  2. 6
      post.php
  3. 10
      templates/post_form.html

10
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;

6
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'])){

10
templates/post_form.html

@ -213,6 +213,16 @@
{{ antibot.html() }}
</td>
</tr>{% endif %}
{% if config.simple_spam and not id %}<tr>
<th>
{{ config.simple_spam.prompt }}
{{ antibot.html() }}
</th>
<td>
<input type="text" name="simple_spam" value="" size="12" maxlength="18" autocomplete="off">
{{ antibot.html() }}
</td>
</tr>{% endif %}
</table>
{{ antibot.html(true) }}
<input type="hidden" name="hash" value="{{ antibot.hash() }}">

Loading…
Cancel
Save