Integration with reCAPTCHA v2
Sobiech 77
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Integration with reCAPTCHA v2
Sobiech
OP
77
From: -
From: -
Thank you, it works!
1 Re: Integration with reCAPTCHA v2
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
There is also a PHP part. Here a possible solution but untested.
Replace the following in /classes/class_system.php:
with:
and change the template to:
Let me know if this will work
Replace the following in /classes/class_system.php:
function dorecaptcha( $var, $var2, $var3, $var4 )
{
$error = 1;
if( function_exists( "curl_exec" ) )
{
$url = curl_init();
curl_setopt( $url, CURLOPT_URL, " http://api-verify.recaptcha.net/verify" );
curl_setopt( $url, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $url, CURLOPT_POSTFIELDS, "privatekey=" . $var . "&remoteip=" . $var2 . "&challenge=" . $var3 . "&response=" . $var4 );
curl_setopt( $url, CURLOPT_USERAGENT, "Esselbach Contentteller CMS" );
$recaptcha = curl_exec( $url );
if ( preg_match( "/true/i", $recaptcha ) )
{
$error = 0;
}
curl_close( $url );
}
return $error;
}
with:
function dorecaptcha( $var, $var2, $var3, $var4 )
{
$error = 1;
if( function_exists( "curl_exec" ) )
{
$url = curl_init();
curl_setopt( $url, CURLOPT_URL, " https://www.google.com/recaptcha/api/siteverify?secret=" . $var . "&remoteip=" . $var2 . "&response=" . $_POST['g-recaptcha-response'] );
curl_setopt( $url, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt( $url, CURLOPT_TIMEOUT, 15);
curl_setopt( $url, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt( $url, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt( $url, CURLOPT_USERAGENT, "Esselbach Contentteller CMS" );
$recaptcha = curl_exec( $url );
curl_close( $url );
$result = json_decode( $recaptcha, TRUE );
if( $result['success'] == "true")
{
$error = 0;
}
}
return $error;
}
and change the template to:
<!-- Template: files_comment_form_recaptcha -->
<script type="text/javascript"
src="https://www.contentteller.com/ https://www.google.com/recaptcha/api.js">
</script>
<div class="g-recaptcha" data-sitekey="{$insert['website_recaptcha_public_key']}"></div>
Let me know if this will work
I added the code <head>:
And I swapped code:
on
but unfortunately in this way does not work.
Thanks!