Jump to content

Quick question about session variable's security


pianoman993

Recommended Posts

How secure are session variables? Ff I had a user successfully login and then created $_SESSION['username'] = $username; variable, would this be safe practice? Is it possible that somebody could get into the session variable and change it? This question is especially important for changing passwords where the username should be remembered server-side for quick database reference. Any comments would be appreciated, thanks a bunch.

- Mark

You should do fine with that. If you store something like the username or user ID in the session then changing the password would not be a problem in respect to remaining logged in. Don't store the password, you wont need it so there is no point in it.

 

However, there are a few aspects you must consider with session security so I would suggest you to read page 7 of my tutorial "PHP Security" which I recently published here.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.