![]() |
Redirect users based on their access level.
I have a users table with id(primary key), userName, password, and access fields. I've set up the log-in to pass userName, password and access to a session variable to validate the user.
There are 3 access levels now. 0, 1, & 2. I would like to add a redirect similar to the error redirect to push users with 0 to the error page (that works now) send users with access level 1 to another page, and access level 2 to a third page. Here's the restrict access code: PHP Code:
I'm beginning to think that I need a dummy page that uses a simple if (access = '1') {go to here} else if (access - '2') go somewhere else. |
Where you have the call:
isAuthorized("",$MM_authorizedUsers, ... you have $MM_authorizedUsers as a comma separated list containing both 1 and 2. If you were to call it with just one of those values then you can put code that is specific to people who have that level of access into an if statement that does that call. Code:
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",'2', $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { |
Thanks for the suggestion. I put it in and it redirects every user to the new page... I must be missing something. Not having very good luck with this so far.
PHP Code:
|
I was way over thinking this problem I ended up simplifying the code substantially and just dropping it to the bottom of the php that runs before the HTML starts. The code that works is amazingly simple.
PHP Code:
I hope this solution solves problems for others. As is my usual practice, I tend to make things way too complicated. |
| All times are GMT +1. The time now is 09:26 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.