Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session help please? 1

Status
Not open for further replies.

WilliamMute007

Programmer
Sep 30, 2007
116
GB
Hi All,

Any chance I can get help with this code please? Am not sure what I am doing wrong but I cant seem to figure out why its not working as it should. I want this verification page to check if a stored session value is say for example 'Director' if so, then navigate them to whatever page depending on the session content else navigate them to a login page.


Code:
if ($_SESSION['loggedin']==Director) {
    header('Location: directors_files.php'); //redirects after successful check
   exit;
    }
elseif ($_SESSION['loggedin']==Consultant) {
    header('Location: consultant_files.php'); //redirects after successful check
   exit;
    } 
else {
header('Location: login_form.php');
}
 
Enquote the comparisons
Code:
if ($_SESSION['loggedin']=='Director'
And ensure of course that the session has been properly started.
 
Foolish me! must be the tiredness :(

Thank you as always Justin.

I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top