Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
Step 1
Create an account with reCAPTCHA (http://www.jobberbase.com/blog/01-23-2008/how-to-implement-recaptcha/)
Go ahead and create an account, download the PHP API (and copy recaptchalib.php in the _includes/ directory, and sign up for an API key.
Step 2.
config.php Define 2 constants, one for public and one for the private API key:
define(‘CAPTCHA_PUBLIC_KEY’, ‘12345_YOUR_PUBLIC_KEY’); define(‘CAPTCHA_PRIVATE_KEY’, ‘12345_YOUR_PRIVATE_KEY’);
Also add the following line (find the other require_once lines), which includes the recaptcha library:
require_once ‘_includes/recaptchalib.php’;
Step 3.
Open page_apply.php, add the following lines of codes after $errors = array();
// captcha Validation $resp = recaptcha_check_answer(CAPTCHA_PRIVATE_KEY,$_SERVER[“REMOTE_ADDR”], $_POST[“recaptcha_challenge_field”],$_POST[“recaptcha_response_field”]); if (!$resp->is_valid) {
$errors[‘captcha’] = ‘Incorrect code’;} // end captcha Validation
Step 4
Open page_job.php
Before $template = ‘job.tpl’, add
// captcha Field $smarty->assign(‘the_captcha’, recaptcha_get_html(CAPTCHA_PUBLIC_KEY)); // End captcha Field
Step 5
open job-detail.tpl, add the following codes before the submit button.
<tr> <td valign=“top”>Anti-spam:</td> <td> {literal} <script type=“text/javascript”> var RecaptchaOptions = { theme : ‘white’, tabindex : 9 }; </script> {/literal} {$the_captcha} {if $smarty.session.apply_errors.captcha} <img src=”{$BASE_URL}img/icon-delete.png” alt=”“ />{/if} </td> </tr>
Thats all folks :)
If you have any problems, please post .
regards
vinay
Have followed your instructions but get the following error:
Notice: Use of undefined constant ?the_captcha? – assumed ‘?the_captcha?’ in /home/scanning/beta/job-listings/page_job.php on line 105
Fatal error: Call to undefined function recaptcha_get_html() in /home/scanning/beta/job-listings/page_job.php on line 105
Any idea?
1 to 5 of 5