By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

How to create anti spam Image

100+
P: 254
Hello I want to create Antispam Image using PHP and GD Library how can I do it.
Feb 8 '08 #1
Share this Question
Share on Google+
10 Replies


MarkoKlacar
Expert 100+
P: 296
Well, you probably have about a million ways to do it. I would probably generate a random string (mixed with chars and ints) and draw some random lines to make it harder to read. What you also can do is rotate or combine different colours.

Hope this helps.
Feb 8 '08 #2

nathj
Expert 100+
P: 938
Hi,

Take a look at this offering

I've used this myself a number of times and it's pretty good.

nathj
Feb 8 '08 #3

Markus
Expert 5K+
P: 6,050
Well, you probably have about a million ways to do it. I would probably generate a random string (mixed with chars and ints) and draw some random lines to make it harder to read. What you also can do is rotate or combine different colours.

Hope this helps.
Personally i hate it when people put lines through it.. absolutely hate it.

I mean, if only a person is going to be able to read it, what good does a disfiguring line do? ABSOLUTELY NOTHING. Except anger me

>=[

[/RANT]

:)
Feb 8 '08 #4

nathj
Expert 100+
P: 938
Personally i hate it when people put lines through it.. absolutely hate it.

I mean, if only a person is going to be able to read it, what good does a disfiguring line do? ABSOLUTELY NOTHING. Except anger me

>=[

[/RANT]

:)
Hey there,

I agree to be hoset and I avoid using captchas except when my boss insist on them - so far only once.

There are better ways to handle form abuse than forcing the user to squint.

nathj
Feb 8 '08 #5

Markus
Expert 5K+
P: 6,050
Hey there,

I agree to be hoset and I avoid using captchas except when my boss insist on them - so far only once.

There are better ways to handle form abuse than forcing the user to squint.

nathj
Yeh, exactly.
I like MySpace's use of them (don't ever quote me as saying i like myspace) - they use them very rarely but often enough to prevent spam; but then again, they do it in some stupid font and a stupid amount of chars, which makes no sense to me - If a computer can't read it, why should it be made difficult for a human to read?

Gah!

Hate captchas, me do.
Feb 8 '08 #6

100+
P: 118
The over all best way is to make a bigger image, with bigger letters (easy to see for a human), have two codes (the human can see which one if you ask, the bot will have to guess).

Make the text stand out (again easy to see), but break down the string with str_split, then make the code with a random number generator, depending on a number, ask the user to input those characters, on the different image. If you have every combination of 5 digit codes between 00000 and 99999 the human can easily recognise it and enter the code but a bot will have a 1 in around 3'075 chance of getting it each time. =P that's only using numbers, if you use letters too that figure will easily be in five figures. Thus not much chance.

Finally, since the characters of the code are individual in array (thanks to string split) but then on the image, place them easy to see but have some at different angles thus the lines of the characters touch and overlap. This ought to confuse OCR programs, since they map out the characters by the lines, if the lines overlap, it'll be harder to do, for it to recognise them but easy for a human to see.

An example of the two codes on one image


there is distortion in the background but the characters stand out. and the user is asked for 5 of the six characters, from either code seen.

An example of standing out text with overlapping (to an extent).



Sam
Feb 8 '08 #7

P: 48
I do not like captchas anyways but there can be a good way to have a dynamically moving (animated) background generated on the fly with some random text in front.

But as Gurus here already said (and I agree) there are better ways other than captchas. Captchas just irritate people.
Feb 8 '08 #8

Markus
Expert 5K+
P: 6,050
The over all best way is to make a bigger image, with bigger letters (easy to see for a human), have two codes (the human can see which one if you ask, the bot will have to guess).

Make the text stand out (again easy to see), but break down the string with str_split, then make the code with a random number generator, depending on a number, ask the user to input those characters, on the different image. If you have every combination of 5 digit codes between 00000 and 99999 the human can easily recognise it and enter the code but a bot will have a 1 in around 3'075 chance of getting it each time. =P that's only using numbers, if you use letters too that figure will easily be in five figures. Thus not much chance.

Finally, since the characters of the code are individual in array (thanks to string split) but then on the image, place them easy to see but have some at different angles thus the lines of the characters touch and overlap. This ought to confuse OCR programs, since they map out the characters by the lines, if the lines overlap, it'll be harder to do, for it to recognise them but easy for a human to see.

An example of the two codes on one image


there is distortion in the background but the characters stand out. and the user is asked for 5 of the six characters, from either code seen.

An example of standing out text with overlapping (to an extent).



Sam
Why would anyone want to do that? I mean, sure it looks 'professional' n all.. but it's just annoying and unnecessary.

A simple image of 4 clear letters and you're done. Hay-presto.
Feb 8 '08 #9

100+
P: 118
Why would anyone want to do that? I mean, sure it looks 'professional' n all.. but it's just annoying and unnecessary.

A simple image of 4 clear letters and you're done. Hay-presto.
Well no, if you need a captcha for registration, to stop spam users, and use a plain background with just for monospaced, regular characters; if they want in they will use a simple OCR (Optical Character Recognition) program and will get it. That's why the more obscure ones that mask the characters slightly that a human can easily read can make it harder for the bot, therefore you won't get any spam users.

Again, if you ask for all 4 characters each time, if the attacker works out how your codes work and their program can read it each time. It'll never stop them. However if you ask for 5characters in any order or even 6 characters from 2 codes a-z 0-9. The bot may be able to read the characters but it then has a 1 in over 10,000 chance of getting it.

Sam
Feb 9 '08 #10

100+
P: 118
Well no, if you need a captcha for registration, to stop spam users, and use a plain background with just for monospaced, regular characters; if they want in they will use a simple OCR (Optical Character Recognition) program and will get it. That's why the more obscure ones that mask the characters slightly that a human can easily read can make it harder for the bot, therefore you won't get any spam users.

Again, if you ask for all 4 characters each time, if the attacker works out how your codes work and their program can read it each time. It'll never stop them. However if you ask for 5characters in any order or even 6 characters from 2 codes a-z 0-9. The bot may be able to read the characters but it then has a 1 in over 10,000 chance of getting it.

Sam
Just realised I wasn't quite right with the a-z 1-9 thing but there is a 1 in 3'075 chance for the bot to guess the code.
Feb 10 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.