php - WooCommerce security on checkout -


i've been trying add kind of security, captcha or security question, checkout form. i've tried using php, add-ons, plugins, can't find works. guys know how can this? it's don't lot of orders bots. preferably in code. tried using

$number = 2 //other wordpress/woocommerce code 'human' => array(             'label'       => __( 'are human?', 'woocommerce' ),             'placeholder' => __( 'what 1 + 1?', 'woocommerce' ),             'required'    => true,             'validate'    => $number         ), 

in woocommerce/includes/class-wc-countries.php wouldn't work: showed form, enter anything, , continue, if entered e.g. 324.

you edit page form on: hide button until user enters captcha correctly, or answers math question properly:

http://jsfiddle.net/robinvandernoord/pexhll2g

    <div id="place_order" style="display:none">     <button onclick="alert('yay')">place order</button> </div> <p style="text-align: left;">[woocommerce_checkout]</p>  <h2>are human?</h2>  <script>     function enable() {         var user = document.getelementbyid("user").value;         if (user === answer) {             var docu = document.getelementbyid("place_order").style;             docu.display = "block";             var eneb = document.getelementbyid("enable").style;             eneb.display = "none";             var met = document.getelementbyid("math").style;             met.display = "none";             var user = document.getelementbyid("user").style;             user.display = "none";         } else {             makemath();         }     } </script> <div id="math"></div> <script>     function makemath() {         var random1 = math.floor(math.random() * 5);         var random2 = math.floor(math.random() * 5);         answer = random1 + random2;         var mat = document.getelementbyid("math");         mat.innerhtml = ""         mat.innerhtml += "what ";         switch (random1) {             case 0:                 mat.innerhtml += "zero";                 break;             case 1:                 mat.innerhtml += "one";                 break;             case 2:                 mat.innerhtml += "two";                 break;             case 3:                 mat.innerhtml += "three"                 break;             case 4:                 mat.innerhtml += "four";                 break;             case 5:                 mat.innerhtml += "five";                 break;             case 6:                 mat.innerhtml += "six";                 break;             default:                 mat.innerhtml += random1;                 break;         }         /*  //mat.innerhtml += " plus "; */         mat.innerhtml += " plus ";         switch (random2) {             case 0:                 mat.innerhtml += "zero";                 break;             case 1:                 mat.innerhtml += "one";                 break;             case 2:                 mat.innerhtml += "two";                 break;             case 3:                 mat.innerhtml += "three"                 break;             case 4:                 mat.innerhtml += "four";                 break;             case 5:                 mat.innerhtml += "five";                 break;             case 6:                 mat.innerhtml += "six";                 break;             default:                 mat.innerhtml += random1;                 break;         }         /* note */         mat.innerhtml += "?";         /* note */         switch (answer) {             case 1:                 answer = "one";                 break;             case 2:                 answer = "two";                 break;             case 3:                 answer = "three";                 break;             case 4:                 answer = "four";                 break;             case 5:                 answer = "five";                 break;             case 6:                 answer = "six";                 break;             case 7:                 answer = "seven";                 break;             case 8:                 answer = "eight";                 break;             case 9:                 answer = "nine";                 break;             case 10:                 answer = "ten";                 break;             case 11:                 answer = "eleven"                 break;             case 12:                 answer = "twelve"                 break;             default:                 answer = answer;                 break;         }     }     makemath(); </script> <input id="user"></input> <div onclick="enable()" id="enable">     <button style="color: white; background-color: #d64181;">go</button> </div> 

someone answer in console, humans know that, right? ;)


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -