Hi

I have successfully engineered a login.php system, complete with logout.php, forgotpass.php and the associated functions which go with that.

My users can log in and log out of the system and go to the pages directed to them without a problem.

I was then asked to create a second login system for a 'coordinator' of the business.

I set up a separate database table, a login_co.php, forgottpass_co.php and associated functions. This also works fine - except that if a user logins in - then the coordinator has also logged in - and if one logs out, they both log out. I suspect it is because they are both using SESSION ID and the table ID = ID? But I dont' know how to separate it and I don't understand why it is happening if the php is looking up ID, username etc from different tables....

Please let me know which code would be helpful to look at.

The site is: www.dev.bright-tutors.com
username: brighttu
pw: liz00

Tutor Login: ebanbury, dog
Coordinator Login: coordinator, cat

You can try and see what I mean.

I'm thinking the cheap & dirty way is to just set up the coordinator as another record on the tutors registration and then in the coordinator login just add something like AND username = ' ' ; - but not ideal.

Any suggestions would be most welcome.

Why does the coordinator need a completely separate table and functions? Typically administrative users are still users, the only difference is permissions attached to the account.

Member Avatar for diafol

Typically administrative users are still users

This is particularly important if using an 'user' class to deal with things like login, permissions etc.

I use the same DB table for both admin and users.
They are identified by an additional column, for example:

:access: 0 = GOD, 1 = admin, 2 = user

So when you query the DB you need to validate the user, and also check against the access level that has been granted. You can then show additional content depending on access

Yes your both right and that was also the conclusion I came to. I'll see if it works better. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.