Preparing just a simple page with the ability to log on. One of the features is to be able to change user data given at registration. My code works as follows.
Logging in:
if(passwordIsCorrect()){
//log in
$_SESSION['user'] = $email;
}
So I write an email or user id to a session variable. When the user completes the form and clicks the submit I write changes to the database searching the appropriate row in the table 'users' using the
$ _SESSION ['user'];
Is this a safe way? Could it be improved in some way?