You are invited to Log in or Register a free Frihost Account!

Captcha: GD Library

Hi guys, i'm semi knowledgeable in php. I'm currently working on to my project in school. I encounter this GD library which is really cool. I'm planning to create my own customize captcha but unfortunately this is my first time to encounter this feature of PHP. I'm wondering if i can create an image with some of words of it using GD library.. thanks!
If your project isn't about making a captcha itself you can stop the spam bots by adding whats called a negative captcha where you can detect that a bot has filled out the form.

Basically the program detects a bot by:
. having 2 or more fields hidden by CSS that must stay blank, the bots will try to fill in every field and not know it's hidden, I like 2, one for an <input> and one for a <textarea> and insert them randomly in the form so they're not always the nth field in the form.
. The field names must all be hashed so the program can't guess what info goes where and they're never the same
. The form expires after a given time so they can't reuse the hashed field names for long
. The form rejects the submission if it's submitted too soon, If they happen to fill it out in less than 6 seconds they get a message trying again.

But then again if you have to give a presentation on it, a graphical capacha would be easier for the teacher to understand than something that goes on behind the scenes.

I don't know how normal capachas are generated but I would create several images of each letter distorted a little differently and in different colors, sizes, rotation saved as a png file with transparency and have the program use them like stamps in a larger image.
I might even put some easy to read text on there at the bottom or corner and cover it up or hide it with css or javascript
I don't know if it's been done before but your capatcha could be an image of all the easy to read letters (no zero and O) and randomly put them the same distance apart to form a sprite image

and use CSS to show only the 6 or so random letters that were picked beforehand. The bots would need to know CSS background positioning to solve it in addition to reading the image because the answer isn't written in the image
Here's an example of the sprite captcha working

If you see an error message you can fix it by going to
wow thanks a lot. Much appreciated your effort and concern.. I learned something.. Thank you so much!!
I kind of like the sprite captcha idea. In order for a bot to defeat it the program has to read the letters and know where they are in the graphic and also be able to handle the css. I doubt any OCR programs will tell them where each letter is in the image.

I made it generate white on white because all an anti-captcha would need to do is a little image processing to remove every color except the #2 most frequent colors to get just the text and background.
Related topics
GD-library header probs
PHP Toturail
How To : Secure Your PHP Website
Dynamic PHP Images
GD or ImageMagick Support?
Does frihost has GD installed?
Does somones use GD library?
GD library?
GD Library...
GD and XS Mod
Having a prob with GD library
url access and gd-library?
Preventing Spam
GD library
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.