I would love to know how to integrate chronoforms with recaptcha.
best regards,
Tommy, Sweden.
It wouldn't be too difficult I think. You'd need to do quite a bit of hacking though.
Bob
PS See http://recaptcha.net/plugins/php/
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!
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
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.
To use reCapcha with ChronoForms[list]
<?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>";
?>
<?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.")";
}
?>
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
Thanks, if you have a moment to add a little hack to the next release of ChronoForms I could easily create this as a PlugIn. We just need a third class of PlugIn that can be called both ONLOAD and ONSUBMIT
Bob
I can do this for sure, let me put the next release and call it RC1 when I finish the new wizard changes then make those new plugin changes in another RC😉
Warm regards,
Max
Hope you are doing well. Well I am trying to install Re-Captcha. However, there is no Server Side Validation in Validation tab. And where to add the Code???
Can you help me? I think I am very close, yet too far.
Thanks
Abhi
I forget that you are in an old version of ChronoForms. You will need to use one of the OnSubmit code boxes and then use showform() to re-display the form. If you search here on showform you should find the syntax OK.
Bob
I was able to use Re-captcha on regsitration page. But, I need for contact use form. not for registration.
Now the GD support is enabled and i can see the images and other stuff in the Anti-Spam menu.
Select the type of image to show ? With Fonts
GD Version bundled (2.0.34 compatible)
FreeType Support Yes
PNG Support Yes
Sample image: ( there is an sample image)
Now that i know GD is working, why i can't see the imageverification image in FF as well as IE7???
Regards
Abhi
try to access the image file directly like this and tell me what you get:
http://www.domain.com/components/com_chronocontact/chrono_verification.php
Max
Thanks for pointing that out - I've updated the instructions. Hopefully with the next release we can turn this into a ChronoForms Plugin if Max hasn't already built it in.
Bob
I am very new to this extension, but I am already in LOVE with it! After too long struggling with RSForms, I decided to try this and I am so glad I did. Awesome, awesome tool!!! Thank you very much for the reCaptcha instructions - they worked perfectly, and now my client will be happy.
All who have developed this extension should be very, very proud. No I'm going over to JED to give it kudos!
Peace,
Rick
PS - I am using RC3, which does not include the reCaptcha plugin. No big deal (your instructions are great), but do you have an idea if this will be implemented in an upcoming release?
Thank you - Max will be delighted to hear that you are so pleased with his work :-)
The ReCaptcha PlugIn is written and working 98% - I didn't quite make it in time for the RC3 release but Max now has the code.
The missing 2% is that in IE7 it sometimes (but not always) triggers an Operation Abandoned alert which has something to do with the sequence of JavaScript loading on the page. I don't think this is solely to do with the PlugIn but is a combination of factors that I haven't managed to bottom out yet :-(
Bob
Max - if you're listening - super work!
Thank you, I'm trying to improve some issues in RC3 in the next 2 days then I will add a new release with the reCaptcha plugin written by Bob after giving it a test to see the IE7 issue myself and maybe I will be able to fix it!🙂
Regards,
Max
I have to turn
JPATH_COMPONENT_SITE.DS.'chrono_recaptchalib.php'
to
JPATH_ROOT.DS.'components/com_chronocontact/chrono_recaptchalib.php'
only in "form code" not in "server validation code"
If this can help others
Regards
Max
Hi all,
To use reCapcha with ChronoForms[list]
<?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>";
?>
<?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.")";
}
?>
Bob
There are two areas where you'll insert the keys. In the first block, include your public key where it shows:
$publickey = "###~~your public key~~###"
And in the second block, replace the private key where you find:
$privatekey = "###~~your private key~~###"
Just make sure you leave the quote marks around your key. You're right - you are almost there! If you need any further help, I'd be happy to assist!
Rick
Have you made sure that the "Use Image Verification" is set to "No" in the "Anti Spam" tab for the form?
Does your sever have GD support enabled?
That's about the extent of my help. Sorry! However, once Bob and/or Max gets online, you'll get much more appropriate help. I just try to give back where I can. Good luck with this!
Rick
@billdematte, please follow Rick's guidance now because I really didn't test this hack myself, Bob made a complete reCaptcha plugin, very clean solution but it will be out with the next release which I'm working at now and keeps me very busy because alot of users are waiting it.
So my advise for now is to play with it till I put the new release online or may be Bob gives you an answer soon but I'm not sure when!
Regards,
Max
Warning: include_once(/home/ncsac4pd/public_html/components/com_content/chrono_recaptchalib.php) [function.include-once]: failed to open stream: No such file or directory in /home/ncsac4pd/public_html/modules/mod_chronocontact/helper.php(319) : eval()'d code on line 158
Warning: include_once() [function.include]: Failed opening '/home/ncsac4pd/public_html/components/com_content/chrono_recaptchalib.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ncsac4pd/public_html/modules/mod_chronocontact/helper.php(319) : eval()'d code on line 158
Fatal error: Call to undefined function recaptcha_get_html() in /home/ncsac4pd/public_html/modules/mod_chronocontact/helper.php(319) : eval()'d code on line 161
Were working fine last week!
EDIT: I just copied chrono_recaptchalib.php to /com_content and it seems to work fine now. Why would it just pop up with that? I don't think I've changed any settings or upgraded anything...
It's because the link is realtive - it will work OK whilst the form is in com_chronocontact but when you use the Plugin or Module to put it on a content page it loses track. Sorry about that - but you found a good fix.
Bob
I heard you had written a slick little plugin for this. Has this been released, or will this still be out with the next release of CF?
Rick
Yes I have, it has a problem with IE7 - sometimes an Operation Aborted message gets triggered and the page won't load. This is something to do with the way the JavaScript loads into the page - combined I think with the remote loading of the ReCaptcha script :-(
When I have a moment I'll see if I can debug it - I don't think it's a problem in the PlugIn itself but one of those 'combination' things. It also doesn't happen all the time - around 10-20% in my quick tests - so not obvious to debug.
Bob
Warning: include_once(JPATH_ROOTDScomponents/com_chronocontact/chrono_recaptchalib.php) [function.include-once]: failed to open stream: No such file or directory in /hermes/web09/b2191/as.designso/public_html/components/com_chronocontact/chronocontact.html.php(74) : eval()'d code on line 182
Warning: include_once() [function.include]: Failed opening 'JPATH_ROOTDScomponents/com_chronocontact/chrono_recaptchalib.php' for inclusion (include_path='.:/usr/local/lib/php-5.2.2/lib/php') in /hermes/web09/b2191/as.designso/public_html/components/com_chronocontact/chronocontact.html.php(74) : eval()'d code on line 182
Fatal error: Call to undefined function recaptcha_get_html() in /hermes/web09/b2191/as.designso/public_html/components/com_chronocontact/chronocontact.html.php(74) : eval()'d code on line 185
Now, as I am running an older vesion of CF, I do not have the Server Side Validation Code Box, so as you suggested I put the following code in the "On Submit code - before sending email" box:
<?php
include_once(JPATH_COMPONENT_SITE.DS.'chrono_recaptchalib.php');
$privatekey = "6LeaGQoAAAAAAHw_MNl8D7llU5i8hzf2JJY7KtBF";
$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.")";
}
The php file you attached is in the proper folder and I'm running out of ideas myself. Thanks for any help!
Recently found chronoforms V4 - it is worth the effort to learn as it has power to make large tasks easy. V4 documentation is a bit thin at present but the forum is very well supported and I'm sure it will achieve exactly what I ask of it. V3 documentation is very complete so expect V4 to progress nicely.