Jump to content

Login for two different user groups


son
 Share

Recommended Posts

I wonder if I can use the same login area for two different types of user (as opposed of creating two different folders with similar files). I was thinking to check username and password against the first user table and if not match is made then to check the seccond user table. If a match for one is made a session variable is creates that denotes which user group and accordingly which files to be displayed. What both groups do is very different, it is not just simply that one cannot create a new entry, but the other one can. It is only as it is on same website and user might be confuse if they stumble accidently across the not relevant user area if you see what I mean. Does this make any sense? I have never done such a thing, but am getting a bit fed up with my redundant files...Son

Link to comment
Share on other sites

You can set up a column as for GROUP rather than making a different table for each groups. and on successful login you store that group in session and can check it in condition and do apropiate things

Link to comment
Share on other sites

You can set up a column as for GROUP rather than making a different table for each groups. and on successful login you store that group in session and can check it in condition and do apropiate things
That is a great idea. Just tested this and works well. instead of only creating one $_SESSION for user, I create now an additional one for superuser. When superuser is set to 1 all pages are displayed in navigation. When not, only certain ones. On pages that are meant for superuser I check for superuser session data and throw user to login page if superuser session not set. On the pages that are accessible for user of all levels i do a similar check, just this time for user (which includes the session user).Seems to work pretty well. Cheers, that saved me a lot of redundant data (which I am trying to avoid as much as possible these days).Son:-)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...