Browse Source

Simple anti-spam mechanism

pull/107/head
Your Name 8 months ago
committed by Zankaria
parent
commit
e2bef8c2f2
  1. 9
      inc/config.php
  2. 6
      post.php
  3. 10
      templates/post_form.html

9
inc/config.php

@ -308,9 +308,16 @@
'json_response', 'json_response',
'user_flag', 'user_flag',
'no_country', '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. // Enable reCaptcha to make spam even harder. Rarely necessary.
$config['recaptcha'] = false; $config['recaptcha'] = false;

6
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($config['securimage']) && $config['securimage']){
if(!isset($_POST['captcha'])){ if(!isset($_POST['captcha'])){

10
templates/post_form.html

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

Loading…
Cancel
Save