views:

45

answers:

2

So i have a form that on paper is 40 pages long. I was going to take the natural sections of this form, and make separate html forms for each section, with the idea that on the first page there would be a first form, then you hit 'Continue to next section' which essentially is the 'submit' button, which moves the user to section two, etc, until they hit the last section. i am not actually storing the results of the form in a database, but rather sending an email. the idea then is to store the separate form answers (one html form per section in the real form) as arrays or objects in the session, so that if they go back to a section in the form, it repopulates the values they entered since they are stored in the session. the result would be an array in the session storing the results for each of my forms, and i have one form for each section.

my question is: is it secure to temporarily store things like SSNs or driver's license numbers as session variables? why or why not?

A: 

Session variables are safe to use in PHP.

They will only contain whatever you stored in them. Session data is stored server side, so it can’t be tampered with client-side. Only a session ID is stored in a cookie on the visitor’s computer.

The dangers arise when session IDs aren’t dealt with properly so malicious users can obtain the session ID of another user and log in under that session.

Mathias Bynens
you took this question wrong probably. user won't tamper with session data as it's his own data he enter. But on the other hand, from the security point of view, sessions are pretty insecure on the shared hosting with default settings.
Col. Shrapnel
I realize nobody would want to tamper with *his own* data. I rephrased to make it more clear that I was talking about potential hack attemps / viruses on the client side.
Mathias Bynens
+1  A: 

Secure or inseure - you have no choice anyway.
If you're talking of your own dedicated server, it's as secure as whole server is.
For the shared hosting there is some precautions to take, session.save_path setting is the first.
You can also gather all sensitive information on the last page and do not store it in a session at all, but email it immediately. Buy the way, do you consider e-mail is safe by default?

Col. Shrapnel