Hello on my phpvms website i need help upgrade my reCapture
from this to this
Hello on my phpvms website i need help upgrade my reCapture
from this to this
https://www.google.com/recaptcha/intro/index.html
Than put the below code in your local.config.php and replace with your keys.
/* Keys for recaptcha, you can change these if you want to your own but it's a global key so it should just work */
Config::Set('RECAPTCHA_PUBLIC_KEY', 'key 1');
Config::Set('RECAPTCHA_PRIVATE_KEY', 'key 2');
already done i put the code
<div class="g-recaptcha" data-sitekey="I -HAVE-TAKEN-OUT"></div>
and once i completed it all it did was refresh the page
anyone help
You will have to place the snippet below before the closing </head> tag on your template:
<script src='https://www.google.com/recaptcha/api.js'></script>
still not working it just refreshes the page
Place this code in the file core_htmlhead.TPL
<script src='https://www.google.com/recaptcha/api.js'></script>
thanks will try
thanks will try
https://www.google.c…ntro/index.html
Than put the below code in your local.config.php and replace with your keys.
/* Keys for recaptcha, you can change these if you want to your own but it’s a global key so it should just work */
Config::Set(‘RECAPTCHA_PUBLIC_KEY’, ‘key 1’);
Config::Set(‘RECAPTCHA_PRIVATE_KEY’, ‘key 2’);
I already told you how to do it.
still not working all it dose is refresh the page
Easiest solution, upgrade to this
https://github.com/D…rk/phpvms_5.5.x
Otherwise
specifically this file https://github.com/D…ecaptchalib.php but try the rest as well
add them to core/lib/recaptcha
https://www.google.c…ntro/index.html get your API Keys
Add this code to your local.config.php (Make sure it’s not already in there otherwise it will cause issues)
/* Keys for recaptcha, you can change these if you want to your own but it’s
a global key so it should just work */
Config::Set(‘RECAPTCHA_PUBLIC_KEY’, ‘YOUR PUBLIC API KEY’);
Config::Set(‘RECAPTCHA_PRIVATE_KEY’, ‘YOUR PRIVATE API KEY’);
Go into your registration_mainform.tpl file and find this
<?php //Put this in a seperate template. Shows the Custom Fields for registration Template::Show('registration_customfields.tpl'); ?>And replace it with this
<?php
//Put this in a seperate template. Shows the Custom Fields for registration
Template::Show('registration_customfields.tpl');
?>
<dt>reCaptcha</dt>
<dd>
<?php if(isset($captcha_error)){echo '<p class="error">'.$captcha_error.'</p>';} ?>
<div class="g-recaptcha" data-sitekey="<?php echo $sitekey;?>"></div>
<script type="text/javascript" src="[url="https://www.google.com/recaptcha/api.js?hl=<?php"]https://www.google.c...api.js?hl=<?php[/url] echo $lang;?>">
</script>
</dd>
Then in core/modules/Registration/Registration.php find this function
protected function VerifyData()
And in there you will find this
$resp = recaptcha_check_answer (Config::Get('RECAPTCHA_PRIVATE_KEY'),
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if(!$resp->is_valid)
{
$error = true;
$this->set('captcha_error', $resp->error);
}
else
$this->set('captcha_error', '');
replace it with this
//Google reCaptcha
//updated to Google noCaptcha 1/15
$resp = null;
$reCaptcha = new ReCaptcha(RECAPTCHA_PRIVATE_KEY);
// Was there a reCAPTCHA response?
if ($_POST["g-recaptcha-response"]) {
$resp = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
//check if reCaptcha response was valid
if ($resp == null) {
$error = true;
$this->set('captcha_error', 'reCaptcha Validation Error');
}
And that should work.
Remember that anything (within reason) is doable, but sometimes you have to look hard to find the answers.