My account page currently looks at what was passed to it from the login page and acts accordingly. If the user entered both a username and password, and they match something in the database, they get content specific to their account. However, if they make a mistake or the input doesn't match, they get error messages and the script ends.
I understand that if the user succeeds in gaining access to their account, I should register their username as a session variable. I also understand that I can use session_is_registered to make sure that the session is registered and this keeps people from just bookmarking their account page.
What I'm confused about is the order that this all occurs. If I check to see if the session is registered later in the script, the earlier errors about not entering a username, etc will be thrown. If I check to see if the session is registered early in the script, it doesn't give a chance for the variables to be created assuming the login was going to succeed.
Does this make sense to anyone?