slscart logo

slscart CAPTCHA Basics

This article describes captcha, a spam control, and an alternative called reCAPTCHA to help protect forms from spam. slscart supports no captcha, captcha, reCaptcha v2, and reCaptcha v3.

What is spam control?

Rogue programs, known as bots, try and fill in forms ... There have been many ways invented to suppress the bots. One method is captcha.

What is captcha?

A CAPTCHA (a backronym for "Completely Automated Public Turing test to tell Computers and Humans Apart") is a type of challenge-response test used in computing to determine whether or not the user is human. Usually distorted numbers and or letters are displayed and the user must enter them in a text box. It helps

What is recaptcha 2?

The weakness in captcha is that character recognition software (OCR) can nearly read all captcha images. Google is the inventor and maintainer of recaptcha. recaptcha supplies hard to read images for OCR. Currently, reCAPTCHA uses a set of images and the user selects a few of them (for example, 9 images show up and the user needs to choose all images that have grass in them). reCAPTCHA is

For recaptcha 2, you will need a Google gmail account.

recaptcha 1 has been discontinued.

What is recaptcha 3?

Marking off images, as recaptcha 2 uses, is a nuisance to users. recaptcha 3 has no interface. It works behind the scenes determining whether the form was filled out by a human or a bot.

For recaptcha 3, you will need a Google gmail account.

Why captcha?

captcha, and other methods, are used to prevent automated programs (bots) from filling out forms on a website and submitting them with false information.

How do I get it working?

There are many forms in slscart that can use captcha.

There are four different ways to handle protecting forms

1. No captcha

Nothing needed, but little protection.

2. Captcha

Nothing to get. Captcha presents letters and numbers which the user has to enter into a textbox.

3. reCaptcha v2 checkbox

First get the site key and secret key (the API keys) from Google. Login to your Google gmail account here:

https://www.google.com/recaptcha/admin

Click on + sign (create)

Fill in label (like 'v2 live'), check reCaptcha v2, enter in your store's domain, check the terms of service, and click Submit.

Copy the site key and secret key into the corresponding v2 public key and v2 private key text boxes under Administration > Extras.

Go to contact page. You will see at the bottom a "I'm not a robot" checkbox. When clicked on, images will appear.

4. reCaptcha v3/v2

reCaptcha v3 is initially used to protect the form. If it fails when the user submits the form, reCaptcha v2 will appear and the user will have to successfully finish v2.

You will need reCaptcha v2 checkbox keys and reCaptcha v3 keys. Follow step 3 to get the v2 public and private keys.

To get the v3 keys,

login using your Google gmail account here: https://www.google.com/recaptcha/admin

Click on + sign (create)

Fill in label (like 'v3 live'), check reCaptcha v3, enter in your store's domain, check the terms of service, and click Submit.

Copy the site key and secret key into the corresponding v3 public key and v3 private key text boxes under Administration > Extras.

Go to the contact page. No box will appear at the bottom but a Privacy Terms box will appear in the bottom right corner. This shows the form is protected by reCaptcha v3.

If reCaptcha v3 fails, reCaptcha v2 checkbox will appear.

Version 10.19.0 and later

Under Administration > Extras

* Set 'Use Captcha' to select one of 'No captcha', 'captcha', 'recaptcha checkbox', 'recaptcha hidden'

If using recaptcha v2 or v3:

* Enter in v2 site key in the v2 Public Key: field

* Enter in v2 secret key in the v2 Private Key: field

If using recaptcha v3:

* Enter in v3 site key in the v3 Public Key: field

* Enter in v3 secret key in the v3 Private Key: field

Note that using recaptcha v3 requires v2 and v3 sets of keys.

Click 'Update Variables' button to save changes.

Version 10.? up to 10.18.0.

Under Administration > Extras

* Set 'Use Captcha' to Yes

* Enter in site key in the Public key: field

* Enter in secret key in the Private key: field

Click 'Update Variables' button to save changes.

Version 10.? and earlier

Edit your config file and add the following lines at the bottom just before ?>

define('SLC_USE_CAPTCHA', true);
define('SLC_RECAPTCHA_SITE_KEY', 'put your site key here');
define('SLC_RECAPTCHA_SECRET_KEY', 'put your secret key here');

Enter your site key and secret key where indicated.

Test it out

Click on Contact Us in the store. You will see the reCAPTCHA addition as shown below:

slscart Contact Us with reCAPTCHA

I have had much better luck using reCAPTCHA than regular captcha.

References

Wikipedia reCAPTCHA - describes in detail what is reCAPTCHA.

***