encodeme
asked on
If session is not user or admin....
Hi,
I'm not sure where my blunder is here.
I want to stay on this page unless the person logged in is not one of user or admin.
I'm not sure where my blunder is here.
I want to stay on this page unless the person logged in is not one of user or admin.
if ($_SESSION['usertype'] != 'user') && ||($_SESSION['usertype'] != 'admin') {
header("Location:index.php");
}
ASKER
Hi Marqus,
My login script directs both user and admin to a page.
What I want is that if anyone else other than user or admin tries to see this page they are directed to index.php.
I'm not sure your solution does this ,
Thanks
My login script directs both user and admin to a page.
What I want is that if anyone else other than user or admin tries to see this page they are directed to index.php.
I'm not sure your solution does this ,
Thanks
Sorry for misunderstanding :-)
if ($_SESSION['usertype'] != 'user') && ($_SESSION['usertype'] != 'admin') {
header("Location:index.php ");
}
if ($_SESSION['usertype'] != 'user') && ($_SESSION['usertype'] != 'admin') {
header("Location:index.php
}
You had an error in your syntax: you wrote && || and this should raise an error: be sure to set error_report(E_ALL);
while you are deplying your scripts (and to comment that lione once script is in production)
Cheers
while you are deplying your scripts (and to comment that lione once script is in production)
Cheers
ASKER
Hi Marqus,
I'm not sure why but it will not run.
I've checked it individually and it works eg.
Where should I place the
I'm not sure why but it will not run.
I've checked it individually and it works eg.
if ($_SESSION['usertype'] != 'admin'){
header("Location:index.php");
}
But when I combine them it does not run.Where should I place the
error_report(E_ALL);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi endoceme,
Thank you for the points, but I really think you should share some of the points to the others who also tried to help you. The solution given by marqusg was almost the same as mine, and bportlock's point about exit() and his suggestion for using CASE were excellent ones. Even if mine is the one you used, they both put in some time and effort to help you.
Why don't you request attention and ask the moderator to reset, then accept again sharing some of the points with those two people.
Cheers,
C.
Thank you for the points, but I really think you should share some of the points to the others who also tried to help you. The solution given by marqusg was almost the same as mine, and bportlock's point about exit() and his suggestion for using CASE were excellent ones. Even if mine is the one you used, they both put in some time and effort to help you.
Why don't you request attention and ask the moderator to reset, then accept again sharing some of the points with those two people.
Cheers,
C.
ASKER
Hi yodercm,
I appreciate your sensitive comments. As with coding ...I'm a begginer here.
I'll try and get the points distributed.
Thanks
encodeme
I appreciate your sensitive comments. As with coding ...I'm a begginer here.
I'll try and get the points distributed.
Thanks
encodeme
ASKER
Phew ... hope that's an acceptable point distribution.
Once more thanks for all the help.
:)
Once more thanks for all the help.
:)
lol, hope you're not too tired after having thought on how to distribute points :-) Thanks for them and thanks to yodercm also: you're always extremely correct.
Thanks Yodercm and encodeme.
Good job, endoceme :)
And if I could only spell, I'd say
Good job, encodeme :)
Good job, encodeme :)
if ($_SESSION['usertype'] == 'user') || ($_SESSION['usertype'] == 'admin') {
header("Location:index.php
}