Last active
August 29, 2015 14:03
-
-
Save jeremyricketts/7d54c39422537dd5c2f1 to your computer and use it in GitHub Desktop.
Three checks. 1) no value for hidden html input, 2) updated value using javascript, 3) 5 second minimum required to fill out a form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<!-- If this has any value, ever, it's spam. Human's don't fill out hidden inputs. --> | |
<input type="hidden" class="spmChkOne"> | |
<!-- If this has anything other than 'ntSpm', it's spam. Bot tried to fill it out sans js. --> | |
<input type="text" class="spmChkTwo" value="spm"> | |
<!-- If this has anything other than 'ntSpm', it's spam. Humans need more than 5 seconds. --> | |
<input type="text" class="spmChkThree"> | |
</form> | |
<script> | |
$(function() { | |
/* | |
============================= | |
Prevent sp@m | |
============================= */ | |
$('.spmChkTwo, .spmChkThree').hide(); | |
$('.spmChkTwo').val('ntSpm'); | |
spm5sec = setTimeout(spm5secGo, 5000); | |
function spm5secGo() { | |
$('.spmChkThree').val('ntSpm'); | |
clearTimeout(spm5sec); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment