Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorflakdesign
    • CommentTimeMar 6th 2008 edited
     

    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

    • CommentAuthorcapone
    • CommentTimeMar 18th 2008
     
    who do we change the look of anti-spam....Iwant a nice design as facebook does. Thanks for guidance
    • CommentAuthorcapone
    • CommentTimeMar 18th 2008
     
    owh i got it....just change it at javascript in job-details.tpl
    • CommentAuthordjaru
    • CommentTimeMar 25th 2008
     
    The code keep crashing ie, works fine on firefox. I cannot get an error message.
  1.  

    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?