I'm creating a secure login script at the moment. The script works like this:
1) On page load, a session ID is generate (session_start)
2) User enters username and password
3) Script clean the user input.
4) Username and password are checked for match in database,
5) If successful, a new session ID is generated, and the user is logged into their account.
Upon the user logging in, how do I retrieve all relevant information about the user from the database? I'm currently storing the user ID (an auto_increment field) in a session, and am using this search for the relevant details in the database?
Is this secure?