Morgan Posted September 14, 2016 Report Share Posted September 14, 2016 (edited) Hello on my phpvms website i need help upgrade my reCapture from this to this Edited October 9, 2016 by Morgan Quote Link to comment Share on other sites More sharing options...
flyalaska Posted September 14, 2016 Report Share Posted September 14, 2016 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'); Quote Link to comment Share on other sites More sharing options...
Morgan Posted September 14, 2016 Author Report Share Posted September 14, 2016 (edited) 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 Edited September 14, 2016 by morgie2233 Quote Link to comment Share on other sites More sharing options...
Morgan Posted September 17, 2016 Author Report Share Posted September 17, 2016 anyone help Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted September 17, 2016 Moderators Report Share Posted September 17, 2016 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> Quote Link to comment Share on other sites More sharing options...
Morgan Posted September 24, 2016 Author Report Share Posted September 24, 2016 still not working it just refreshes the page Quote Link to comment Share on other sites More sharing options...
eliezerazevedo Posted October 5, 2016 Report Share Posted October 5, 2016 Place this code in the file core_htmlhead.TPL <script src='https://www.google.com/recaptcha/api.js'></script> Quote Link to comment Share on other sites More sharing options...
Morgan Posted October 9, 2016 Author Report Share Posted October 9, 2016 thanks will try Quote Link to comment Share on other sites More sharing options...
flyalaska Posted October 9, 2016 Report Share Posted October 9, 2016 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. Quote Link to comment Share on other sites More sharing options...
Morgan Posted October 9, 2016 Author Report Share Posted October 9, 2016 still not working all it dose is refresh the page Quote Link to comment Share on other sites More sharing options...
web541 Posted October 9, 2016 Report Share Posted October 9, 2016 (edited) Easiest solution, upgrade to this https://github.com/D...rk/phpvms_5.5.x Otherwise 1. Re-add these files to the location https://github.com/D...e/lib/recaptcha specifically this file https://github.com/D...ecaptchalib.php but try the rest as well add them to core/lib/recaptcha 2. https://www.google.c...ntro/index.html get your API Keys 3. 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'); 4. 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'); ?> <dt>reCaptcha</dt> <dd> <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> </dd> 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> 5. 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. Edited October 9, 2016 by web541 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.