Ok. I'm almost there. So far I've got the code to display the captcha installed properly. I'm having a problem with the validation routine. Currently, when a customer enters the contents of the form but forgets to enter the captcha the form displays an error telling them to enter it, which is what's supposed to happen. However, if the customer enters the captcha correctly the form doesn't process the contents properly; it just resets and all the information is lost. I need help writing the code so that the form processes properly and the customer is taken to the create account success page.
Here's the code for the captcha in red as I have it in the create_account.php form:
Code:
/**
* Process form contents
*/
//BOF reCAPTCHA
require_once('includes/templates/custom/templates/recaptchalib.php');
$privatekey = "6LXXXXXXXXXXXXXXXXAT";
$captcha_resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($_POST['action'] == 'process' && !$captcha_resp->is_valid) {
$error = true;
}
//EOF reCAPTCHA
if (isset($_POST['action']) && ($_POST['action'] == 'process') && !$captcha_resp->is_valid) {
$process = true;
if (ACCOUNT_GENDER == 'true') {
if (isset($_POST['gender'])) {
$gender = zen_db_prepare_input($_POST['gender']);
} else {
$gender = false;
}
}
if (isset($_POST['email_format'])) {
$email_format = zen_db_prepare_input($_POST['email_format']);
}
Any ideas?
Bookmarks