开发者

POST[]ing Extra Values

I am creating a custom captcha where random numbers are generated and you have to add them together etc. As of right now I am echo-ing these random numbers but now I need to pull them into a external file开发者_开发技巧 to test the sum against the input text. Can I add these to the POST[] array on form submission?


You have to have some way of keeping track of the numbers and retrieving them back later for verification. You could use session variables- put the numbers in at the time of the page load, and then again when the form is POST'd and check them against each other.

Also, keep in mind anything on the form or that is put in $_POST can be easily viewed by anyone attempting to fool this process. Putting them in session variables makes it much harder for someone to view the contents of what their numbers will be checked against.


Shouldn't be necessary to post the numbers back. Just store them in a session variable on the server (or even just store the desired answer) and compare that. There'd be no point in storing the individual numbers, since they'd be thrown away and new ones generated each time anyways - captcha images/tests should never be reused.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜