I need to add a captcha code to http://www.morecambe-directory.com/directory.php?ax=add I have no idea where to start, i looked at Free php captcha but just dont know where to add the code :-( can anyone help me please? regards Jackie
My suggestion would be to use ReCaptcha, it is one of the best and is a free solution, they provide examples that explain everything. They require API keys, you can signup for it here: http://recaptcha.net/whyrecaptcha.html a quick example for your install would look like this: In your template for adding a URL you will have a section that looks like this: <td class="bodymd">OImage URL (Optional) (Images size 125x100 pixels)<br /> <input type="text" name="image" size="60" value="" maxlength="100"/></td></tr> <tr><td class="bodymd"> Email Address:<br /><input type="text" name="email" size="50"/></td></tr> <tr><td class="bodymd"> Password:<br /><input type="password" name="password" size="10"/></td></tr> PHP: change it to: <td class="bodymd">OImage URL (Optional) (Images size 125x100 pixels)<br /> <input type="text" name="image" size="60" value="" maxlength="100"/></td></tr> <tr><td class="bodymd"> Email Address:<br /><input type="text" name="email" size="50"/></td></tr> <tr><td class="bodymd"> Password:<br /><input type="password" name="password" size="10"/></td></tr> <tr><td class="bodymd">[captcha]</td></tr> PHP: in the top of directory.php on the top line before anything else add: <?php require_once('recaptchalib.php'); $publickey = "..."; // you got this from the signup page $privatekey = "..."; if($ax=="add"){ $captcha=recaptcha_get_html($publickey); } else if($ax=="insert"){ $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } } ?> PHP: In order to determine how to make it show on the form in place of [captcha] I need to know if the html for the form is in directory.php or is a seperate html template. Once you tell me that i will give you the code to add to directory.php to show it on the form.
Cool! I needed to know how to add a reCaptcha to my form. Will this still work if I'm using Javascript to validate my form? I'll give it a go, and post back on my experience.
Should work aslong as your form is PHP based, doesn't matter what validation you use - but I suggest if you do use JS you should also do server side validation (as JS can be disabled).
Damn, I've been at it for a while now, and finding it hard to install. Ok, I have my form in my contact.html, and I have 1 php file with all the code for the form, and a javascript folder with all the jquery files. I think for me is knowing where to add that piece code on the form, php file or javascript files?? P.S I am also using a opensource CMS, so maybe that's why it's not working properly Thanks
Please guys, can someone help me, I'm still stuck here. Maybe I should provide the link: http://www.dmaireroa.com/mail/contact.php