Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Pages: 1
Bonjour,
comment pourrais-je ajouter un captcha "reload" ?
en JavaScript je sais, mais comment devrais-je gérer cela avec le ZF?
Je génère le captcha avec Zend_Form_Element_Captcha comme une image.
Merci d'avance
Hors ligne
Bonjour,
Bon c'est très simple,tu commence tout d'abord par l'inscription pour avoir un compte sur http://recaptcha.net/ et puis pour obtenir deux clés "pubKey" et "privKey" ,tu mets les clés dans ton formulaire:
$pubKey = 'ici le code'; $privKey = 'et encore ici'; $recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey); $adapter = new Zend_Captcha_ReCaptcha(); $adapter->setService($recaptcha); $captcha = new Zend_Form_Element_Captcha('recaptcha', array( 'label' => "Captcha", 'captcha' => $adapter)); $captcha->removeDecorator('label')->removeDecorator('errors');
et voilà ton "captcha" est activé.Finalement pour personnaliser l'apparence du "captcha",je n'ai pas une idée pour le moment mais je pense en utilisant javascript.
A+.Nll
Dernière modification par elec (21-12-2009 12:58:39)
Hors ligne
Merci
en faite j'utilisais pas le recaptcha c'est plutot
$captcha = new Zend_Form_Element_Captcha ( 'captcha', // This is the name of the input field array ('label' => 'Write the chars to the field', '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.'/../application/utils/font/QuantasRegular.ttf', // Where to put the image 'imgDir' => APPLICATION_PATH.'/../application/utils/images/', // URL to the images // This was bogus, here's how it should be... Sorry again :S 'imgUrl' => $config->production->siteName.'/athentification/application/utils/images/' ) ) ); /*$captcha->setCaptcha('Dumb') ->setIgnore(true);*/
Hors ligne
Pages: 1