Basically I have a redirection for all pages to send the user to the login page if they are not logged in. The problem is, I am using the same headers, footers etc for every page, so I wrote this to fit in somewhere:
[PHP]if ( $_SESSION['user_name'] == NULL ) {
echo( " <meta http-equiv=\"refresh \" content=\"0;url =login.php\"> " );
}[/PHP]
It works but it still loads the whole (or atleast most of the) page before it redirects, which I can't have.
So I want to only continue loading the page if it passes, and in all other reasons, redirect to my login page: using something like:
[PHP]if ( $_SESSION['user_name'] == NULL && $_REQUEST != login.php ) {
echo( " <meta http-equiv=\"refresh \" content=\"0;url =login.php\"> " );
}[/PHP]
Just so it doesn't redirect on the login page into a loop. What is the command that should be in place of "$_REQUEST != login.php"?
TS
[PHP]if ( $_SESSION['user_name'] == NULL ) {
echo( " <meta http-equiv=\"refresh \" content=\"0;url =login.php\"> " );
}[/PHP]
It works but it still loads the whole (or atleast most of the) page before it redirects, which I can't have.
So I want to only continue loading the page if it passes, and in all other reasons, redirect to my login page: using something like:
[PHP]if ( $_SESSION['user_name'] == NULL && $_REQUEST != login.php ) {
echo( " <meta http-equiv=\"refresh \" content=\"0;url =login.php\"> " );
}[/PHP]
Just so it doesn't redirect on the login page into a loop. What is the command that should be in place of "$_REQUEST != login.php"?
TS
Comment