Captchas in PHP

I’ve been playing around with generating “captcha” images from PHP. Captchas are those Turing-test images used to screen out bots — the image contains text that a human is asked to type to demonstrate his/her humanity.

I generated these images using PHP5 and the gd image library which comes bundled with PHP. Two questions: 1) are they easy enough to read? 2) would they be hard enough to OCR?

I’d like to make a PHP-based captcha facility generally available, either as code or as a web service, in hopes that it would help in the fight against blog comment spam. (More about that when it’s ready.)

8 thoughts on “Captchas in PHP”

  1. Definitely readable. They ‘look’ easier than some other captchas (e.g. Yahoo!’s reg captchas).

    Have you tried OCR’ing them with some of the free tools?

  2. Yeah, that had occurred to me as a worry, though I hadn’t seen this article.

    I quickly scanned the article, and although it’s obviously right about the problem, it doesn’t contain any very good alternatives for your everyday blogger. The relevant suggestions break down into 1) using other modalities, which can themselves be impaired (interestingly, they include cognitive impairments as an argument against logic puzzles), 2) very delayed feeback approaches (live operators), 3) possession of a credit card, and 4) being part of a much larger infrastructure, like MSFT single-signon. If anyone sees a good alternative approach that I’m missing, I’m interested.

  3. (In case you’re wondering, the reason the link in comment #2 is not clickable is that the designers of this blogware knew that allowing links in blog comments would encourage blog spammers. An ironic impediment to the dissemination of accessibility information, isn’t it?)

    Also, I have to be honest and say that I think that there is some inevitable tradeoff between accessibility and abuse, and the decision about how to trade those things off should be up to individual bloggers and webmasters.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s