|
General Details
|
|
PHP (Hypertext Preprocess...
|
|
Posted 3.45 Years Ago
|
|
674 Views
|
|
Received 2 Ratings
|
|
Simple but highly effective CAPTCHA
Description
Uses any TTF (TrueType Font) which is native to Windows & Mac to generate completely random captcha images. Create the "fonts" folder where you place the script and upload a TTF file in binary mode.
Uses a session variable encrypted using MD5 to pass the code to the script using it.
Has support for background images to help mask the code but comes defaulted with a black background.
The characters used to create the code are defined in the script so any font chosen by the user that has similar looking characters can be disabled.
The characters for the code are at random angles in random colors.
I wrote this as I wanted something custom and that behaved exactly like I wanted it to. I've been running this on my website for about 2 years now and I've never received any unwanted spam in my inbox or my guestbook.
Technical
1. Just requires a TrueType Font (TTF) installed into the appropriate folder.
2. GD library
Comes with a sample script on how to use it.
Source Code
|
Download Source Code
ivan's captcha script.zip ( 0.22Mb )
|
NEVER open a .exe, .bat, .cmd, or other executable file since that is where viruses are likely to live. Please virus scan all files you download.
|
Comments
| Please login to post comments. |
|
|
Thanks Uranium, creative criticism is always welcome and I'll work on a newer and better version.
The one thing I'm trying to avoid doing is going so far that it makes reading the code difficult for humans like I've seen happen with so many others. I'll add support for multiple fonts/backgrounds and work on other areas of the code as suggested.
|
|
|
It isn't that effective....
A decent programmer could break that without too much of an issue. The weaknesses are:
- You always use the same font at the same font size (makes it easier to bruteforce)
- The changing of the colors in the letters does nothing, you only have a black background so anything which is not black is obviously a letter.
- Leadinging on from the above, that it is easy to detect which objects are the charachters, you can get around the rotation issue by mearly rotating them in such away that the object height as as great as possible, you can then align all the charachters (even if they arn't vertical, they will be aligned in the same manner) and just look them up in the file.
If you want to make it better:
- Randomize fonts, to similar (not too similar), but different fonts (not too different).
- Draw random shapes in the background, this will make it alot harder to seperate charachters from shapes.
- Randomize the background to make it alot harder to select the charachters.
Also, a comment on the code itself (I'm not a PHP coder, but I guess its the ame throughout all languages):
[code]for ($i=0;$i<strlen($strText);$i++) {[/code]
You call strlen() on every cycle, which is inefficient and unneccessary. Do something like this:
[code]for($i = 0, $n = strlen($strText); $i < $n; $i++){[/code]
|
|
|
You're right, that is a zero. I removed capital "O" from the inclusion list to allow for all numbers to be used as well as a couple other letters that can be confused with other characters.
There's added support within the script for background images to be used but there's only so far you can go before humans find it too difficult to read which defeats the object.
|
|
|
http://supertunaman.com/captcha_needs_obfuscation.png
It looks good, but captchakiller figured it out (for the most part at least, that's a zero there, right?).
If you keep developing this thing and keep producing captchas to test, I could test them for you with my API key.
|
|
|
As mentioned, I've been using it on both my contact and guestbook pages and not mentioned was it's the only CAPTCHA I implement on sites I make and I've not had any bad feedback yet.
You may get the odd letter that has a bit missing where it strays too far past the edge but nothing that can't be read.
|
|
|
Wew, now i like that! Great code mate :-D
Are there any known bugs in it at all? Like some letters going off the canvas.
Kind regards,
Scott
|
More "PHP (Hypertext Preprocessor)" Source Codes By This Author
Recently Posted "PHP (Hypertext Preprocessor)" Source Codes
Recently Rated "PHP (Hypertext Preprocessor)" Source Codes
|