Find jobs - Online Advertising - Sciences in 2007 - Wordpress Themes - Debt Consolidation

PDA

View Full Version : Assigning Roles to Users


newlearn
May 24th 2007, 8:43 am
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?

tinkerbox
May 24th 2007, 9:12 am
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';
}

}


Page for each level can access/see differently:

session_start();
if ($_SESSION['level'] == '1') {
// show to manager
}

Hope you'll get some idea how to do it :)

newlearn
May 24th 2007, 9:41 am
Thankyou so much. I will try to see how I can get things work with this.

tinkerbox
May 24th 2007, 9:45 am
post update here.
always happy to help :D

newlearn
Jun 18th 2007, 11:53 am
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 .

newlearn
Jun 19th 2007, 9:16 am
Somebody please reply.