ReCAPTCHA

From EggeWiki
Jump to navigation Jump to search

reCAPTCHA is a great web service, which allows you to add CAPTCHAs to your site. What makes reCAPTCHA interesting is:

  • It uses CAPTCHA's to help digitize books
  • It's a web service, meaning your host doesn't have to generate the image.
  • It also has a CAPTCHA service for obfuscating email addresses.
  • It's accessible. Most CAPTCHA's don't have an audio version for the visually impaired
  • It allows you to get a different image without reloading the page.

I think this is a great project, and I've been keen to get it working on my site. I tried to get it to work with my photo gallery about a month ago, but I failed. I was trying to hard to make it a configurable plugin which others could use. Last night, though, I was successful in adding it to my guest book.

Previously, I had found and integrated a PHP CAPTCHA into my guest book, to help prevent the spam bots. Unfortunately, at some point, it [PHP_Tips#Shared_Hosting stopped working]. The fonts that I was using disappeared from the directory on the shared host. I should have copied them locally, but now it's too late.

reCAPTCHA has a great little PHP library which you can download and reference from your PHP application.

Downloading it was as easy as ssh'ing into my web host and running these commands: <geshi lang="bash> $ curl http://recaptcha.googlecode.com/files/recaptcha-php-1.9.zip > recaptcha.zip $ unzip recaptcha.zip $ cp recaptcha-php-1.9/recaptchalib.php . </geshi>

I was able to modify and remove my old CAPTCHA system and replace it with reCAPTCHA in about 90 minutes. Most of this time was spent searching where in the code I needed to make the changes. Adding the reCAPTCHA code was drop dead simple. I have it mostly working now. The only problem is it doesn't save values when you press 'back' in your browser. I don't want to spend the time to fix up the guest book to do this.

Next, I added the email obfuscater. This was much simpler than the CAPTCHA bit, and took me about a half hour from start to finish. I hope more web applications add support for reCAPTCHA, as it's much better than most system which you find, and it's doing some good!

EmailCAPTCHA.png