CeaseFireBlack
Regular Member
- Jun 10, 2015
- 446
- 185
guys, daily i get 20 bots subscribing to my website, which is very annoying, how to avoid them ? thank you
<form>
...
<p id="hint"></p><input id="captcha" type="text"></input></p>
<input id="submit_form" type="submit" value="send" disabled>
</form>
<script type="text/javascript">
var rand1 = ;
var rand2 = ;
$(document).ready(function(){
rand1 = Math.floor((Math.random() * 10) + 1);
rand2 = Math.floor((Math.random() * 10) + 1);
$('#hint').text(rand1.toString() + ' + ' + rand2.toString() + ' = ' );
})
$('#captcha').on('input', function() {
if (parseInt($(this).val()) == rand1 + rand2) {
$('#submit_form').prop('disabled', true);
}
else{
$('#submit_form').prop('disabled', false);
};
});
</script>
I blocked them with .htaccess in the past.
Search for "block bots .htaccess" there is a great video that helped me but I can't find it at the moment.
For new bots, install a capcha as someone said above.