robetus Posted August 17, 2020 Share Posted August 17, 2020 I have successfully added hCaptcha to my WHMCS checkout using the hook: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function limitOrders($vars) { $url = 'https://hcaptcha.com/siteverify'; $privatekey = "my-private-key"; $response = file_get_contents($url . "?secret=" . $privatekey . "&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']); $data = json_decode($response); if (isset($data->success) AND $data->success == true) { // everything is ok! } else { { global $errormessage; $errormessage.= "<li> Please, confirm that you are not a robot! <br/></li>"; } //if CC } } //function add_hook("ShoppingCartValidateCheckout", 1, "limitOrders"); and the following html code in checkout.tpl: <script src="https://www.hcaptcha.com/1/api.js" async defer></script> <center><div class="h-captcha" data-sitekey="my-sitekey"></div></center><br> Is there an easy to make this work on the submitticket.php?step=2 page which is what I use for my contact form? Recaptcha doesn't work well for my site and I'm getting to much spam with WHMCS' built in captcha which is really bad. 0 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.