I think you need to tighten up the logic on your code...
For example, one block of code should deal with the form submission:
if user submitted the form {
// Deal with input and set for example $_SESSION['validUser']
}
The previous block only deals with validating a user and NOTHING else.
On another part of your code you can have:
if (isset($_SESSION['validUser'])) {
// Show premium content or whatever you want registered users to be able to see
}
This is much simpler and saves the brain damage for the tough parts.