Reputation: 75
I have the following code to re-direct users to their rightfull pages. However, I am getting an error in the browser:
Error:
The page is not re-directing correctly
The code:
<?php
/**
* User has already logged in, so display relevant links, including
* a link to the admin center if the user is an administrator.
*/
if (($session->logged_in) && ($session->isAgent())) {
header("Location: gallery_Agent.php");
} elseif (($session->logged_in) && ($session->isMaster())) {
header("Location: gallery_Master.php");
} elseif (($session->logged_in) && ($session->isAdmin())) {
header("Location: gallery_Admin.php");
}
else { ...
How may I fix this?
Joseph
Upvotes: 0
Views: 95
Reputation: 63542
This error usually indicates an infinite redirect loop. Always use exit()
after setting the Location
header, and make sure you're not including this redirect logic in the pages you're redirecting to.
Upvotes: 1