Beispiel #1
0
 private function generateCaptcha()
 {
     $captcha = new Zend_Captcha_Figlet(array('name' => 'captch_verify', 'wordLen' => 3, 'timeout' => 200));
     $captcha->generate();
     return $captcha->render();
 }
Beispiel #2
0
 public function testCaptchaShouldBeConfigurableViaConfigObject()
 {
     $options = array('name' => 'foo', 'sessionClass' => 'Zend_Captcha_FigletTest_SessionContainer', 'wordLen' => 6, 'timeout' => 300);
     $config = new Zend_Config($options);
     $captcha = new Zend_Captcha_Figlet($config);
     $test = $captcha->getOptions();
     $this->assertEquals($options, $test);
 }
Beispiel #3
0
<?php

// Creating a Zend_View instance
$view = new Zend_View();
$captcha = new Zend_Captcha_Figlet(array('name' => 'foo', 'wordLen' => 6, 'timeout' => 300));
if (!empty($_POST)) {
    if ($captcha->isValid($_POST['foo'], $_POST)) {
        // Validated!
    }
}
$id = $captcha->generate();
?>
<form method="post" action="">
<?php 
echo $captcha->render($view);
?>

<input type="hidden" name="foo[id]" value="<?php 
echo $id;
?>
" />
<input type="text" name="foo[input]" /><br />

<input type="submit" value="Submit" />
</form>