Hey, if you don't mind, stick a carriage return amidst all those spaces so this thread isn't so wide ... 😉
I don't ever use session names...don't see where you need to on this script.
Try including this edit to your code:
if ($user == $myuser && $pass == $mypass) {
$_SESSION['auth_user']=1;
header ('location: main.php');
}
Then, on each page you want protected:
if ($_SESSION['auth_user']!=1) {
header("Location: login.php");
}
Finally, let's rethink the logic. Why don't you just a] test for good combination, set the auth var and call the header. b] test for null fields/invalid login, print the error, then exit(). c] include the form in an else() so that you get that message for all other conditions....
HTH,