I'm working on a website where there will be three types of users: admin, managers, and operators. I want to give access for these groups for them to only be able to view certain pages or certain menus in these pages when they login. How do i go about doing this? im still just a beginner in php so any information or tutorials to implement this will be helpful.
This is a loaded question, in my experience you will want to make three tables. I will highlight basic columns to make it work
User user_id, login, password
Access access_id, access_code, access_name
UserAccess user_access_id, access_id
Then create the accesses you want like Administrator give it an access code like admin_rights, Manager with access code manager_rights, and so on.
Then assign the users the access you want to give them. The pages you will assign the access_codes that can view the page and if the user has the access type it can view the page. As far as code goes there is a lot to show so if you need more help,let me know.
You could go even further and add a Role table that allows you to assign multiple accesses to and then assign a role to a user.
Role role_id, role_name
RoleAccess role_access_id, role_id, access_id
UserRole user_role_id, role_id, user_id
It gets complex, but in the long run it allows you to set up many different user types and allows for you to get specific for special users that you want to have access to this and that and don't fit a predefined role.