Jump to content

redirecting user


droidus

Recommended Posts

i am trying to redirect a user to a certain page, if the credentials are not right.  if there is no session user, they are kicked out.  if it is set, but to the guest account, they go to the login page with a special error message.  here is my code for it:

 

if (!isset($_SESSION['user']))
{
  		header('Location: portal.php?logintocontinue');
	exit;
}
elseif($_SESSION['user'] == "guest") {
	header('Location: portal.php?invalidLogin');
	exit;
}
else {

}

 

after attempting to run the page, with session user = guest, i get this error message: The page isn't redirecting properly.

 

does it have to do with headers already being sent?

Link to comment
https://forums.phpfreaks.com/topic/245885-redirecting-user/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.