FormMail Captcha
From KOP KB
This is where you can signup for the keys https://www.google.com/recaptcha/admin#whyrecaptcha
Referrers and Recipients
Make sure the customer has this set up properly as well
#whatever domains they decided to use should go in referrers.
@referers = ('www.domain.com','domain.com');
# @recipients defines the e-mail addresses or domain names that e-mail can #
# be sent to. This must be filled in correctly to prevent SPAM and allow #
# valid addresses to receive e-mail. Read the documentation to find out how #
# this variable works!!! It is EXTREMELY IMPORTANT. #
# If we are troubleshooting the receiving make sure this has a string of the email and not a variable #
@recipients = '[email protected]';
Use LWP
This will need to be put just before it shows all the &check's down the page
use LWP::UserAgent;
Calling the Check Captcha
You can add this anywhere near &check lines
# Check the captcha challenge and response.
&check_captcha;
Checking the Captcha
This actually checks the captcha that was typed in
##############################################################################
# Check the CAPTCHA response via the reCAPTCHA service.
sub check_captcha {
my $ua = LWP::UserAgent->new();
my $result=$ua->post(
'http://www.google.com/recaptcha/api/verify',
{
privatekey => 'your_private_key',
remoteip => $ENV{'REMOTE_ADDR'},
challenge => $Form{'recaptcha_challenge_field'},
response => $Form{'recaptcha_response_field'}
});
if ( $result->is_success && $result->content =~ /^true/) {
return;
} else {
&error('captcha_failed');
}
}