Ok Nikola, evo i koda
Ovo je kod iz forme:
...
Code:
$ruta= realpath(dirname(__FILE__).'/../../');
$captcha = new Zend_Form_Element_Captcha(
'captcha', // This is the name of the input field
array('label' => 'Unesite karaktere sa slike:',
'captcha' => array( // Here comes the magic...
// First the type...
'captcha' => 'Image',
// Length of the word...
'wordLen' => 6,
// Captcha timeout, 5 mins
'timeout' => 300,
// What font to use...
'font' => APPLICATION_PATH .'/Intramural.ttf',
// Where to put the image
'imgDir' =>$ruta.'/public/tmpcap', //kod mene vraca putanju: /opt/lampp/htdocs/mojprojekat/public/tmpcap
// URL to the images
'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl().'/tmpcap/', //vraća: /public/tmpcap/
)));
$captcha->removeDecorator('HtmlTag');
//$captcha->addDecorator('HtmlTag', array('tag' => 'contact'));
...
Ovo je deo koda iz kontrolera-obradjuje post metod:
...
Code:
# // So here's the ID...
$captchaId =$form->getValue($captcha['id']);
// And here's the user submitted word...
$captchaInput = $form->getValue($captcha['input']);
// We are accessing the session with the corresponding namespace
// Try overwriting this, hah!
$captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_'.$captchaId);
// To access what's inside the session, we need the Iterator
// So we get one...
$captchaIterator = $captchaSession->getIterator();
// And here's the correct word which is on the image...
$captchaWord =$form->getValue($captchaIterator['word']);
//Tell the browser what kind of file is come in
// Now just compare them...
if($captchaInput == $captchaWord)
{
// OK nešto}else{//nešto}
Već postajem frustriran...verovatno je neka sitnica ili nešto gde mi treba pomoć admina hosta? Please help,help,help!