I need some guidance about assigning roles to different users of an Application. There are three levels. Managers, Employees and Users. When users login, how will I make sure that not all access is gven to them in the application. Are there any tutorials that can give me little idea about how to do this?
When login assign value to each of them using session. Eg: if ($login_ok) { session_start(); if ($login_as == "manager") { $_SESSION['level'] = '1'; } else if ($login_as == "employee") { $_SESSION['level'] = '2'; } else if ($login_as == "user") { $_SESSION['level'] = '3'; } } PHP: Page for each level can access/see differently: session_start(); if ($_SESSION['level'] == '1') { // show to manager } PHP: Hope you'll get some idea how to do it
I have couple of more doubts . When I check for userLevels during login, should I have separate pages for different levels. Like - showTable.php will have 3 copies - showTableManager.php , showTableAdmin.php, showtableEmp.php Other way, I was thinking to go with if conditions for the data to be displayed or hidden on the same file showTable.php .