Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-03-2008, 06:21 PM
dele454's Avatar
Member
 
Join Date: Jun 2008
Posts: 48
Default Zend_Capcha

hi,

i am trying to verify the text submitted to match that of the captcha. If valid(same) echo 'validated'.
Code:
class JoinController extends Zend_Controller_Action
{

                public function indexAction(){
               
                $this->_helper->layout->setLayout('layout-site');
                $view = new Zend_View();
                // Originating request:
                $captcha = new Zend_Captcha_Image(array(
                        'name' => 'captcha',
                        'height' => 100,
                        'width' => 202,
                        'wordLen'=> '6',
                        'expiration' => '300',
                        'font' => 'C:/xampp/htdocs/xampp/mainevent/public_html/img/font/ravie.ttf',
                        'imgDir'=>'C:/xampp/htdocs/xampp/mainevent/public_html/img/captcha',
                        'imgUrl' => '../img/captcha',
                        'fontSize' => '24',
                      
                       
                       
                ));
                $id = $captcha->generate();
                $this->view->showCaptcha = $captcha->render($view);
               
               
               
                if ($captcha->isValid($_POST['captcha'])) {
                   echo "Validated!";
                 
                 }
                 else{ echo "no";
                 print_r($captcha->getMessages());}
                }
         
               

}
When i submit the form it always echos 'no'!. Printing the error message i get this

Array ( [badCaptcha] => Captcha value is wrong )

How can i sort this out. I am thinking the captcha will always have a different value on post when compared to the text field. How can i resolve this.

Last edited by dele454 : 11-03-2008 at 06:26 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:28 AM.