Simple anti-spam mechanism

This commit is contained in:
Your Name 2023-09-10 23:46:38 +02:00 committed by Zankaria
parent ea67272e87
commit e2bef8c2f2
3 changed files with 24 additions and 1 deletions

View File

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

View File

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

View File

@ -213,6 +213,16 @@
{{ antibot.html() }}
</td>
</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>
{{ antibot.html(true) }}
<input type="hidden" name="hash" value="{{ antibot.hash() }}">