1

I am using this PHP captcha tool on my website: https://web.archive.org/web/20060703144957/http://www.white-hat-web-design.co.uk/articles/php-captcha.php

After filling out a form, and depending on if the user inputs the correct security code, the user is taken to a success or failure page. However, if the user returns to the form using the Back button, the the form is empty.

It's a very complicated form with a lot of JavaScript arrays, so it's not practical to re-fill the form automatically unless I can write all the data to a file.

Can I run the captcha processor without loading a new web page? Or, is there an alternate captcha library that works without reloading the web page?

2

recaptcha is a common solution provided by Google.

The library contributes a required field to your form, blocking submission until the user has passed the challenge, so there's no risk of the user losing entered data.

To start using reCAPTCHA, you need to sign up for an API key pair for your site. The key pair consists of a site key and secret key. The site key is used to invoke reCAPTCHA service on your site or mobile application. The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user's response. https://developers.google.com/recaptcha/intro

  • 1
    Note that reCaptcha is not privacy friendly, and its use might scare away those who feel their privacy important. Google already has its tendrils in too many sites (reCaptcha, Analytics, Ads; estimatedly 80% of all websites use at least one of those, enabling Google to collect data on most of your online activities, which leads to a "super profile"). I'd never put anything like that on my pages. – Izzy Jun 22 '18 at 9:38
  • Part of my site is on github, so the key pair may be a bad idea. Everyone will be able to see the key. Can I store the key in a separate PHP file in a separate folder? – posfan12 Jun 23 '18 at 9:26
  • Definitely don't commit secrets! The recommended way to deploy secrets is via environment variables; see 12factor.net – ptim Jun 23 '18 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.