Jump to content

How we 1. can redirect a page & 2. To add recaptcha into checkout?


ody

Recommended Posts

1. We would like to redirect some pages into new one as like our default Register a New Domain

https://mynewdomain.com/cart.php?a=add&domain=register to

https://mynewdomain.com/myNEWregisterpage.php ????

 

Is there any easy way to do that we had try some with .htaccess but...

 

2. We had ask in the past into our forum a way about how to add recaptcha into checkout

a good friend "hideipvpn"

 

give us the following code

 

"by hideipvpn" you can try this hook, it's working for me.

 

first you need to add this line with your viewcart.tpl

<div class="g-recaptcha" data-sitekey="YOUR SITE KEY"></div>

Also add this to your template header: <script src='https://www.google.com/recaptcha/api.js'></script>

 

Replace "YOUR SITE KEY" and in hook script "ENTER YOUR KEY HERE" with your keys.

 

OK we have done it and work recapthca apears into checkout but ...

 

 

"by hideipvpn"We use recaptcha v2 and it's only for CC payments, if you want to use for any payment method just make this changes in the code.

 

for checkout which is the right entry into following code???

and

all this code where we added it into checkout page??? or do we create a new php file??? or we create a new hook???

 

 

<?php

if (!defined("WHMCS"))

die("This file cannot be accessed directly");

 

 

function limitOrders($vars) {

 

$url = 'https://www.google.com/recaptcha/api/siteverify';

$privatekey = "ENTER YOUR KEY HERE";

$response = file_get_contents($url."?secret=".$privatekey."&re sponse=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']);

$data = json_decode($response);

 

if (isset($data->success) AND $data->success==true) {

// everything is ok!

} else {

 

$pm = $vars['paymentmethod'];

 

if ($pm=="stripe")

{

global $errormessage;

$errormessage .= "<li> Please, confirm that you are not a robot! <br/></li>";

} //if CC

 

}

 

} //function

 

add_hook("ShoppingCartValidateCheckout", 1, "limitOrders");

?>

 

Thank you in advance

Ody

Edited by ody
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated