Page 1 of 1

How to generate turing number

Posted: Thu Oct 13, 2005 1:53 am
by heya
How can i generate random numbers and make it as image to serve as a validation in the log in.

thanks.

Posted: Thu Oct 13, 2005 3:10 am
by heya
i am getting this error

Warning: imagepng(): Unable to open 'verify.png' for writing in

Posted: Thu Oct 13, 2005 7:40 am
by feyd
your script should not be storing the file, instead it should be returning it to the browser as if it were the image itself.

For future reference, they are called Captcha.

Posted: Thu Oct 13, 2005 8:52 am
by chrys
feyd wrote:your script should not be storing the file, instead it should be returning it to the browser as if it were the image itself.

For future reference, they are called Captcha.
The thing about posting directly to the browser is you have to send the proper image headers... then you can't display anything other than the image? Correct me if I'm wrong.

Posted: Thu Oct 13, 2005 9:02 am
by feyd
you are absolutely correct. The form script needs to reference the Captcha script as an image. The Captcha script must return image headers and the image data as if it were an image, with nothing else in its stream. The Captcha's (if it's not predictable based on the inputs) answer and whatever information was used to create it should be stored in a database table and associated with the user in some fashion (session id comes to mind). Each page request should generate a completely new Captcha, destroying/replacing any existing Captchas that haven't been answered by that user...