forked from leftypol/leftypol
Simple anti-spam mechanism
This commit is contained in:
parent
ea67272e87
commit
e2bef8c2f2
|
@ -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;
|
||||
|
||||
|
|
6
post.php
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($_POST['captcha'])){
|
||||
|
|
|
@ -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() }}">
|
||||
|
|
Loading…
Reference in New Issue
Block a user