CAPTCHA/Integration/The Anti-CAPTCHA/Stronger

From Wikibooks, open books for an open world
Jump to: navigation, search

This version of the Anti-CAPTCHA is stronger.

Form Code[edit]

JavaScript[edit]

document.write("<input type=hidden name=code value="+Math.random()+" />");

This must be in your form.

Use in an HTML form:

<script type="text/javascript">
document.write("<input type=hidden name=code value="+Math.random()+" />");
</script>

Server-Side Code[edit]

Use this:

<?php
 
if (!$_POST['code']) {
   // abort
}
 
?>

Problems with this version[edit]

It hinders the usability, as people with JavaScript disabled (for example, for security reasons) won't be able to access your form.

See also[edit]