Pressure is nothing more than the shadow of great opportunity. - Michael Johnson

Downloads / Scripts

Visual and Audio CAPTCHA class

PhpCaptcha is a library for generating visual and audio CAPTCHAs (completely automated public Turing test to tell computers and humans apart). You can read more about CAPTCHAs at Wikipedia.

It can help you to prevent/reduce:

  • Automated sign-ups in registration forms.
  • Comment spam in blogs and guestbooks.
  • Brute force attacks on login systems.

The library is loosely based on an article I wrote for SitePoint on 9th November 2005 - Toughen Forms' Security with an Image.

Supported Features

  • Multiple random TrueType fonts
  • Character rotation
  • Optional chararacter shadow support
  • Optional site owner display text
  • Random custom background images
  • Font size selection
  • Greyscale or colour lines and characters
  • Character set selection
  • Integration of validation function for checking the user entered code with the generated code

More Information

Click here for documentation, examples and to download the code.

PhpDelicious

PhpDelicious is a class for accessing the del.icio.us API.

Supported Features

  • Viewing (all, by tag, by date etc), adding and deleting posts
  • Managing tags
  • Managing bundles
  • Viewing the last time your account was updated

It includes a configurable caching mechanism to prevent unneccessary additional calls to the API and automatically adds a delay between API calls where neccessary to prevent your account being throttled (receiving 503 errors).

More Information

Click here for more information and to download the class.

PhpCache

PhpCache is a simple PHP class for, you've guessed it, caching arbitrary data. Cached information is stored in files in a temporary directory. File locks prevent simutaneous write attempts.

  1. <?php
  2. // key and cache length (in seconds)
  3. $oCache = new Cache('content_key_here', 300);
  4. // check for cached copy
  5. if (!$oCache->Check()) {
  6. // no cached copy - generate data
  7. // save to cache
  8. $oCache->Set($aNewData);
  9. }
  10. // retrieve data from cache
  11. $aData = $oCache->Get();
  12. ?>

More Information

Download the PhpCache class here.

Email Validation Class

This class provides comprehensive validation of e-mail addresses including MX record lookup, mail server connection test and correction of mis-spelt domain names. It's still experimental so go easy on it if it doesn't behave exactly how you expect. ;-)

More Information

Download the class here.

Unobtrusive click tracking with a splash of DOM scripting

This blog post explains how to implement unobtrusive link tracking on your site. It uses JavaScript and DOM methods to rewrite all URLs on your site on-the-fly and only requires you to add one line of code to your HTML to implement across your site. An improved/alternative version of this click-tracking is available in a later blog post as well as a corresponding link reporting script in this blog post.