Categories
PHP

Text based Captcha with PHP

I needed text based captcha for my mobile web application to stop automated registrations. The mobile application was developed targeting the WAP devices without any fancy JS or iFrame support. So, I was forced to put some text based captcha. I set one up earlier which didn’t require any database but it was just an eye wash. If anyone examined the HTML source, s/he would know how to break it through.

This time I have come up with something better, something more effective. It is quite simple. Have a look at the source code and you’ll understand yourself.

The SQL for the Table:

The TextCaptcha Class :

You might notice that I haven’t used the “time” field. It will be used to delete unused captcha via cron or in some other way. Didn’t get the time to code that.

And how to use it:

Have fun! If you don’t get anything, please place a question below.

One reply on “Text based Captcha with PHP”

Comments are closed.