Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

ColdFusion reCAPTCHA tag
Project Home Forums Wiki Known Issues External Project Link Contact Project

Author: RocketBoots (All RIAForge projects by this author)
Last Updated: June 3, 2010 10:37 PM
Version: 1.1
Views: 107,081
Downloads: 18,893
License: GPL (GNU General Public License)

Description:

-----------------------

Just wanted to say THANKS! I got everything working a couple nights ago, and ever since then... ZERO spam. After a rough couple weeks of sometimes up to 100 spam bot entries per day in my guest book, I am a very happy camper.

- Danny Engesser

-----------------------



Here's a super quick way to implement a captcha solution for your web site and help the book readers of the world at the same time.

Young Mike Crawford from the AFR Access project headed over to the US last year to make his fortune, however discovering that he had missed the gold rush by some one hundred and fifty eight years he decided to settle for a merely interesting job at Carnegie Mellon in Pittsburgh.

Mike pinged me a few days ago to let me know that they were going live with their first project, reCAPTCHA. This is a really interesting project - basically they are providing a free "captcha" API for people to integrate into their sites. The twist is that they are mixing failed OCR scan data from book digitisation projects into the captcha image, so every time someone enters a captcha response they are actually helping to digitise a book! Considering that an estimated 60 million captcha responses are entered every day there's a potential to digitise about 127 very smudged and fly-spotted Lord of the Rings in the same period.

Some APIs are already available for reCAPTCHA but there wasn't one for ColdFusion, so I've created a simple tag that does the job. To use it you will need to apply for some keys. Here's a simple example of the tag in use:

Sample 1 - Combined check/render
   --------------------------------

      <html>
      <body>

      <cfform>

         <cf_recaptcha
            privateKey="...your private key..."
            publicKey="...your public key...">

         <cfinput type="submit" name="submit">

      </cfform>

      <cfif isDefined("form.submit")>
         <cfoutput>recaptcha says #form.recaptcha#</cfoutput>
      </cfif>

      </body>
      </html>


   Sample 2 - Separate check/render
   --------------------------------

      <html>
      <body>

      <cf_recaptcha action="check"
         privateKey="...your private key..."
         publicKey="...your public key...">

      <cfif isDefined("form.submit")>
         <cfoutput>recaptcha says #form.recaptcha#</cfoutput>
      </cfif>

      <cfform>

         <cf_recaptcha
            privateKey="...your private key..."
            publicKey="...your public key...">

         <cfinput type="submit" name="submit">

      </cfform>

      </body>
      </html>


   @param publicKey    Public key sent from browser with request for a challenge string.
                  Note that if this is wrong you will not get a ColdFusion error and
                  an error message will appear in place of the reCAPTCHA form controls.

   @param privateKey Private key sent from ColdFusion server to reCAPTCHA's verification service.

   @param action       render|check default render.
                  "render" checks the submitted form and renders the reCAPTCHA form field.
                  "check" checks the submitted form but does not render the form field.

   @param ssl          set true if form on ssl page to use secured version of reCAPTCHA API and
                  avoid browser complaints.

   @param theme       red|white|blackgrass default red. Changes look of reCAPTCHA form field.

   @param tabIndex      tabIndex of entry field on form.

   @return            sets form.recaptcha to true/false

   @throws            RECAPTCHA_ATTRIBUTE            Missing or invalid attribute
                  RECAPTCHA_NO_SERVICE         Cannot contact verification service
                  RECAPTCHA_VERIFICATION_FAILURE   Verification service responded with an error


You can check the response without rendering the form field if necessary - there is an example in the comments. If you want to see the tag in action I've integrated it into the comments dialog on this site.

Requirements:

ColdFusion 7

Issue Tracker:

ID ISSUE STATUS UPDATED
9 Everything seemed ok but form.recaptcha always false Open 08/20/14 4:11 PM
13 Spammers are getting through Open 09/03/13 6:00 AM
12 attribute ssl not true false Open 08/15/12 9:29 AM
10 The URLs for the recaptcha have changed Open 05/22/12 10:31 AM
11 Standard Theme "clean" missing Open 05/08/12 10:23 AM

View All Issues

To enter issues for this (or any other) project, you must be logged in.