How to generate turing number

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
heya
Forum Newbie
Posts: 10
Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines

How to generate turing number

Post by heya »

How can i generate random numbers and make it as image to serve as a validation in the log in.

thanks.
heya
Forum Newbie
Posts: 10
Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines

Post by heya »

i am getting this error

Warning: imagepng(): Unable to open 'verify.png' for writing in
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
chrys
Forum Contributor
Posts: 118
Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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...
Post Reply