chronoforms with recaptcha

tommyhome 21 Mar, 2008
Hi,

I would love to know how to integrate chronoforms with recaptcha.

best regards,
Tommy, Sweden.
johnnyl 29 Mar, 2008
If anyone has figured out the code modifications which need to be done to use recaptcha, I would be interested in seeing them here...

I would like to try it out, but don't have the time to spend hacking around right now. So if anyone else has already done it and doesn't mind sharing, that would be great!
steveharman 31 Jan, 2009
Seconded! This would be incredibly useful, for ChronoForms as a product and us as users.

I'm happy to have a go and will post my findings / instructions here if I get things to work, if someone could point me at the right file(s) to start looking at within ChronoForms please?

Thanks,

Steve
GreyHead 31 Jan, 2009
Hi steve, johnny and all,

I have reCaptcha working in ChronoForms - here's a test form, try as much as you like the form just submits and re-displays.

It's a bit of a mess so I'll clean the code up and then post it here. No core code hacks required.

Bob

PS It's on my site because the reCaptcha key is domain specific.

PPS I think it could be put in a ChronoForms PlugIn but that does need a core hack to let the Plugn run both on load and submit.
GreyHead 31 Jan, 2009
Hi all,

To use reCapcha with ChronoForms[list]
  • Sign up for reCaptcha and get Public and Private keys for your domain
  • Unzip and copy the attached chrono_recaptchalib.php file into your components/com_chronocontact folder
  • Add this code to your Form HTML where you want the reCaptcha to appear
    <?php
    include_once(JPATH_COMPONENT_SITE.DS.'chrono_recaptchalib.php');
    // you got this from the signup page
    $publickey = "###~~your public key~~###"; 
    echo "<div style='width:312px; height:125px;'>".recaptcha_get_html($publickey)."</div>";
    ?>
  • Go to the Validation Tab for your Form and enable Server Side Validation.
  • Enter this code in the ServerSide Validation Code box
    <?php
    include_once(JPATH_COMPONENT_SITE.DS.'chrono_recaptchalib.php');
    $privatekey = "###~~your private key~~###";
    $resp = recaptcha_check_answer (
        $privatekey,
        $_SERVER["REMOTE_ADDR"],
        JRequest::getVar("recaptcha_challenge_field"),
        JRequest::getVar("recaptcha_response_field") );
    
    if ( !$resp->is_valid ) {
      return "The reCAPTCHA wasn't entered correctly. Go back and try it again<br />
      (reCAPTCHA said: ".$resp->error.")";
    }
    ?>
  • Make sure that you have the correct reCaptcha key in each code block
  • [/list]
    Bob

    PS The chrono_recaptchalib.zip has some added Joomla protection and some un-needed code striped out.
    Max_admin 01 Feb, 2009
    Hi Bob,

    Thank you very much for posting this great tutorial🙂 I will copy it to the hacks forums and will add it to the next release or the next one!

    Best rgeards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    Nadeem 11 Aug, 2011
    Hi greyhead and max,

    I need your help, I followed the above instructions and pasted this code in my form html, but the page breaks... any idea??

    html code: <?php
    include_once(JPATH_COMPONENT_SITE.DS.'chrono_recaptchalib.php');
    // you got this from the signup page
    $publickey = "using my public key";
    echo "<div style='width:312px; height:125px;'>".recaptcha_get_html($publickey)."</div>";
    ?>

    Settings: serverside validation: ON
    spam image verification: OFF
    Recaptcha plugin enabled: True
    GreyHead 11 Aug, 2011
    Hi Nadeem,

    This is an old thread. The current releases of ChronoForms have ReCaptcha included.

    Bob
    This topic is locked and no more replies can be posted.

    VPS & Email Hosting 20% discount
    hostinger