Jump to content

pass the password or the $token?


freelance84

Recommended Posts

OK I have another question on $_SESSION.

 

After my "check_login" script has got the entered username and password, stripped any slashes...etc, I then add some salting to the password and run it through "sha1", the end product is called $token and this should then match the password stored in the members table in MySQL.

 

The book I am using says to pass the original password to the $_SESSION['password']. Should I not be passing the $token as the password instead as this is what is stored in the members table, and is more secure? Or would this actually make it less secure as I would be passing the actual password stored in the table?

Link to comment
Share on other sites

Storing the password or the sha1 of the salted password in a session variable does not make sense because that does not uniquely identify the visitor (many users could have the same password.)

 

Storing the username or userid in a session variable is what is normally used to identify a logged in visitor.

Link to comment
Share on other sites

No sorry, I'm also storing the in the $_SESSION the username, user type, forname and surname.

 

So i can gather that once the password has been checked at the start there is no need for it to be passed on in the $_SESSION unless required later on in the site? That actually makes more sense.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.