< CAPTCHA < Integration < The Anti-CAPTCHA

This version of the Anti-CAPTCHA is stronger.

Form Code

JavaScript

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

Use this:

<?php

if (!$_POST['code']) {
   // abort
}

?>

Problems with this version

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

See also

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.