Re: suggestions

From: Date: Thu, 03 Mar 2005 17:32:27 +0000
Subject: Re: suggestions
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38756@lists.php.net to get a copy of this message
Mignon Hunter wrote:
Hello
Mignon, this is really a php-generals question me thinks (you don't even mention a DB ;-), regardless....
I need to dev a small app and I can think of a couple different ways to handle it but not sure the best way. I need to register those who come to our site that want to download .pdf's. They will fill out some information before I redirect to the pdf. I'm thinking the best way to handle this is sessions, but is it appropriate to store all of the users info - so that if he downloads 2 items - I can re-populate the fields so he doesnt have to? So if they click on an additional pdf I'll need to somehow check for the session and re-populate 11 fields, and they will only have to fill in one field at that time. Or would cookies be better ? I need to store probably 11 different form variables. Also - would you store the variables in an array in the session? This seems neat and tidy...
lets see: if you put the data in a cookie then you are allowing malicious users to change that data after you have stored it (so you will have to check it _everytime_ you want to use it)... best to stick an array in the $_SESSION array.. that way you oly need you sanitize the data when you add/change it - there is no problem with storing an array with 11 items it in in the session, and using an array rather than 'loose' variables would definitely be neater - you have all the user/pdf data in on place and its easy to extend that ammount of info you store (i.e. if your client decides users must fill out more information to download a pdf)
Hope this is clear. Any advice/guidance/sample scripts would be appreciated. Thanks


« previous php.db (#38756) next »