>On many websites they have a blurred image with a code which you're
supposed to reenter in a text box to validate your form submission.
How do I implement such a thing using php?
Make up a bunch of images with blurry pieces (e.g. a single letter
each). Select a code randomly. Put together the pieces showing
that code into a big one with the complete code (this might be just
HTML putting the images side-by-side). Be careful how you name
your images (e.g. calling them A.jpg, B.jpg, C.jpg, ... might let
a bot figure out the code without actually looking at the image.)
You may want to have several differently-blurry images for each
letter. Compare the code the user input against the correct answer.
Apart from preventing automatic form submission by any malicious robot,
does this serve any other purpose?
It slows down automatic rapid-fire form submission by a
not-necessarily-malicious robot or user (load throttling). Other
than that, this is pretty much the only point of doing it.
Beware that some bots have volunteer humans working for them to
solve these puzzles. The bot will promise (usually in SPAM) the
human something, like free access to a porn site, and then relay
your images to him. When he inputs the code, the bot passes it on
to your site. The bot may or may not deliver on its promises to
the human.
Gordon L. Burditt