Hi,

If there are multiple type of users - Super Admin, Admin, Clients should i have to use seperate SESSION variables for each type of users? Or should i have to maintain the session in single variable?


Thanks

Use as many variables as necessary. Just write statements that restrict access based on user level. Example:

if($_SESSION['user']=="Super Admin"){
echo "Welcome Super Admin";
//allow Super Admin to do whatever
}
else{
header ('location:index.php?your_not_allowed_in_here');//do a redirect if access is not allowed
}

hello..
add one more field to your login table like type..
and set it 1 as for superadmin, 2 for admin,3 for client...
and register that type field in your session variable like..

//some statements...
$_SESSION['user']=$row['type];

And in your pages:

if($_SESSION['user']=="1"){
     echo "Welcome Super Admin";//or use header to redirect to some page...
   else  if($_SESSION['user']=="2"){
  echo "Welcome  Admin";//or use header to redirect to some page...
       }
         else if($_SESSION['user']=="3"){
        echo "Welcome  Client";//or use header to redirect to some page...
      }
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.