I just built a simple login system that uses sessions. When the script verifies that the username and password are both correct, it sets $_SESSION[username]
and $_SESSION[role]
, and then on every page of the site it just checks whether these 2 session variables are set.
Considering that the server handles the sessions, this should be a secure solution, right? Or should I set $_SESSION[md5(password)]
as well when logging in, and then check on each page of the site whether all session variables match the user data in the database?