C3rd
ReCaptcha and SAJAX Integration
Posted: 18 Apr 2012, 18:17pm - WednesdayIt's been a while using this method and I'm posting this since my friends are asking how to integrate the Recaptcha and SAJAX. What to edit:
- Edit recaptchalib.php (ReCaptcha Library File), at line 106 or under recaptcha_get_html() function, add "id" attributes of both recaptcha_challenge_field and recaptcha_response_field.
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) { if ($pubkey == null || $pubkey == '') { die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); } if ($use_ssl) { $server = RECAPTCHA_API_SECURE_SERVER; } else { $server = RECAPTCHA_API_SERVER; } $errorpart = ""; if ($error) { $errorpart = "&error=" . $error; } return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '&hl=en"></script> <noscript> <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" id="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" id="recaptcha_response_field" value="manual_challenge"/> </noscript>'; }Source Code: recaptcha_sajax.zip