Introduction

Captcha Operation

All CAPTCHA adapter implement Zend_Captcha_Adapter, which looks like the following:

  1. span style="color: #808080; font-style: italic;">// Additionally, to satisfy Zend_Validate_Interface:

The name setter and getter are used to specify and retrieve the CAPTCHA identifier. getDecorator() can be used to specify a Zend_Form decorator either by name or returning an actual decorator object. The most interesting methods are generate() and render(). generate() is used to create the CAPTCHA token. This process typically will store the token in the session so that you may compare against it in subsequent requests. render() is used to render the information that represents the CAPTCHA, be it an image, a figlet, a logic problem, or some other CAPTCHA.

A typical use case might look like the following:

  1. // Creating a Zend_View instance
  2. // Originating request:
  3. 'name' => 'foo',
  4.     'wordLen' => 6,
  5.     'timeout'"<form method=\"post\" action=\"\">""</form>";
  6.  
  7. // On subsequent request:
  8. // Assume captcha setup as before, the value of $_POST['foo']
  9. // would be key/value array: id => captcha ID, input => captcha value
  10. 'foo'// Validated!
  11. }

Introduction