Bonjour,
Je n'arrive pas à utiliser simpleCaptcha. 
Dans mon formulaire, j'ai, comme dans la doc, simplement mis une div vide :
1 2 3
| <div id="captcha"></div>
<input name="btn_creer_compte" type="submit" value="Créer mon compte" />
</form> |
Mes fichiers ajax PHP sont stockés dans Application/ajax et l'URL rewriting opère ainsi dans le .htaccess :
RewriteRule ^([a-zA-Z\/]+)\/(aj_)([a-zA-Z_]+)$ Application/ajax/aj_$3.php [L]
Dans le fichier Javascript chargé avec la page d'inscription, j'ai ceci :
1 2 3 4 5
| $('#captcha').simpleCaptcha({
// any options you want to set
scriptPath: baseChemin() + '/fr/Accueil/aj_simpleCaptcha',
introText: "Pour être sûr que vous êtes bien un humain, veuillez cliquer sur <span class='captchaText'></span>.</p>"
}); |
Les images sont stockées dans Public/img/captchaImages ; donc dans le fichier aj_simpleCaptcha.php, j'ai ceci :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| class SimpleCaptcha
{
// ------------------------------------------------- //
// -------------------- EDIT THESE ----------------- //
// ------------------------------------------------- //
//
// Note that if they are relative paths, they must be
// relative to THIS script!
private $images = array(
// NAME => IMAGE_FILE
'maison' => 'Public/img/captchaImages/01.png',
'clé' => 'Public/img/captchaImages/02.png',
'drapeau' => 'Public/img/captchaImages/03.png',
'pendule' => 'Public/img/captchaImages/04.png',
'insecte' => 'Public/img/captchaImages/05.png',
'stylo' => 'Public/img/captchaImages/06.png',
'lampe' => 'Public/img/captchaImages/07.png',
'notes de musique' => 'Public/img/captchaImages/08.png',
'coeur' => 'Public/img/captchaImages/09.png',
'monde' => 'Public/img/captchaImages/10.png'
); |
Enfin, dans le traitement du formulaire posté, j'ai ajouté ça :
1 2 3 4
| if (isset($_SESSION['simpleCaptchaAnswer']) && $_POST['captchaSelection'] == $_SESSION['simpleCaptchaAnswer'])
{
echo "captcha OK";
} |
Je pense pourtant avoir fait comme c'est indiqué dans la doc mais rien ne se passe ! Les images de captcha ne sont jamais affichées et l'inscription se fait lorsque je poste mon formulaire rempli... sans captcha. 
Quelqu'un a une idée ou un autre système de Captcha à me proposer ?
Partager