SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do i query and then compare them ??

    i have three tables
    Code:
    menu:: menuId,menuName,page
    permission:: permissionId,PermissionDesc
    menuPermission:: menuId,permissionId
    when user logs in i store his permissions in session array like
    $_SESSION['permission'][permissions]
    Code:
    for eg. $_SESSION['permission'][1]=all (read,write,delte)
    $_SESSION['permission'][2]=read
    $_SESSION['permission'][3]=write....
    now the only thing that is bothering me is how do i check for permissions??.. i was planning when i load the page depending on the menu item selected by user i also load the permissions and compare them??
    BUT HOW DO I DO THIS i just couldn't figure out
    Help please

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i still couldn't figure out. what ya think how i would do this. thanx

  3. #3
    Are You There? KDesigns's Avatar
    Join Date
    Oct 2003
    Location
    Your Monitor
    Posts
    1,147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you set a var with the value being that of the session permission data and then compare it:
    PHP Code:
    switch ($permission) {
        case 
    1:
            echo(
    'You are able to do all!');
            break;
        case 
    2:
            echo(
    'You are able to read...');
             break;
    //etc, etc, etc

    ChooseDaily.com - Follow on Twitter
    Top Resources for Web Designers and Developers Every Day!

  4. #4
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx. but the problem is i am not sure how many cases would i need. it depeneds on the user. a user may have 3 permissions(say read,write or delete) or only 1(read only) or 1 as (administrator).

    these dynamic permissions are stored in session as $_SESSION['permission'][1-4]. and every menu has dynamic permissions as i mentioned above.
    so, i am not sure how to work this out and how to compare them


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •