Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

One web site I have written has a 'register your interest' form which simply  
e-mails the data, this is working fine except some people seem to get off on  
repeatedly using the form to send phoney data. I guess this is from some  
kind of web-bot so I would like to attempt to program around this problem.

One solution is using a distorted image of some letters (CAPTCHA?), however  
I was wondering if anybody has chosen a simpler method, and whether my  
simple method would be impervious to web-bots?

1/ Generate a random string of letters
2/ Ask the user to select from 3 combo boxes 3 random positions, e.g. select  
letters 2, 6 and 7 from LKJIUVBJH.


Barry Morris

Re: Captcha's

An noise sounding like Barry Morris said:
Quoted text here. Click to load it
Easy to program around, but unless someone actively wants to circumvent it
probably will do the trick.

There are however plenty of easy to plug in captcha libraries out there.
Google is your friend here.

Trees with square roots don't have very natural logs.
What's the difference between ignorance and apathy? Who knows? Who cares?

Re: Captcha's

I was looking for a captcha class recently myself. has
several.  hn_captcha was my favorite:

Quoted text here. Click to load it

Re: Captcha's

Thank you all for the advice, I will look at various and recommended  
Captcha's for a solution.



Re: Captcha's

Quoted text here. Click to load it
CAPTCHA is good if the picture is not too distorted :-)
But you need not use CAPTCHA. I have easier way.

You generate two keys and place in <form>

$n1 = chr(rand(65, 90));
$n2 = chr(rand(65, 90));
$n3 = chr(rand(65, 90));
$n4 = chr(rand(65, 90));
$n5 = chr(rand(65, 90));
$key1 = $n1 . $n5 . $n3 . $n2 . $n4; # the sequence know YOU only
$key2 = $n4 . $n1 . $n2 . $n5 . $n3; # the sequence know YOU only
echo "<input type='hidden' name='key1' value='$key1'>",
        "<input type='hidden' name='key1' value='$key2'>";

After submit you do some check like this

$key1 = $_POST["key1"];
$key2 = $_POST["key2"];
$k1 = substr($key1,0,1) . substr($key1,3,1) . substr($key1,2,1) .  
substr($key1,4,1) . substr($key1,2,1);
$k2 = substr($key2,1,1) . substr($key2,2,1) . substr($key2,4,1) .  
substr($key2,0,1) . substr($key2,3,1);
if($k1 ne $k2) {
        echo "I don't like robots";

This is example only. You can to generate keys containing 50 chars and time  
to time you can make changes in PHP code :-)


Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail  
from another non-spammer site please.)

Re: Captcha's


on 11/03/2006 07:49 PM Barry Morris said the following:
Quoted text here. Click to load it

Most Web bots hackers would not bother to defeat simple CAPTCHAs unless
the benefits of defeating it as very high.

If you want to have CAPTCHA validation integrated in forms with other
fields that have their own types of validation, you may want to try this
forms generation and validation class that comes with a plug-in to
implement a CAPTCHA control with almost no effort:


Manuel Lemos

Metastorage - Data object relational mapping layer generator

PHP Classes - Free ready to use OOP components written in PHP

Re: Captcha's

I've written an accessible, multiple choice question based captcha,
it's available at

Site Timeline