Change Left side menu according to user type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    Change Left side menu according to user type

    In my application there are 3 user types and after thy logging i want to display different link according to the user type. (Eg: I want to hide some links from the normal user that are accessible only for administrators. ) How can i do that?
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    Hi,
    If you have the users access writes available, you could stick them all in embeded if statements, or using a switch.


    I included a switch, it does need to be bult upon tho

    Code:
    <?php
    $varAccess = 1;
    
    switch ($varAccess)
    {
    case 1:
      echo "Link 1";
      echo "Link 2";
      echo "Link 3";
      echo "Link 4";
      break;
    case 2:
      echo "Link 1";
      echo "Link 2";
      echo "Link 4";
      break;
    case 3:
      echo "Link 1";
      break;
    default:
      echo "Please Login";
    }
    ?>

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Since you do not show any code, I'll guess.
      [php]
      if ($user_authoriz ation == 9) { // admin
      echo '<a hef="admin_menu .php">Link 1</a>';
      }
      elseif ($user_authoriz ation == 1) { // special user
      echo '<a hef="special menu.php">Link 2</a>';
      }
      else {
      echo '<a hef="normal_men u.php">Link 3</a>'; // normal user
      }
      [/php]
      If you do not show the code, that's all I can show you.

      Ronald

      Comment

      • ghjk
        Contributor
        • Jan 2008
        • 250

        #4
        Still confusing. May i need to use sessions?

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          For what would you want to use sessions? To store user data? Since we still see no code, I am afraid that is all I can tell you.

          Ronald

          Comment

          • harshmaul
            Recognized Expert Contributor
            • Jul 2007
            • 490

            #6
            Hi,
            I have to agree qith ronver, we can only suggest ideas, we can't solve your problem without some code that you have written.

            Please post the code you have made?

            If you haven't made anything yet please start now...



            This link will get you started, And if you ask ronver nicely he might be able to find you a thread of an admin login thing he did which is top quality

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              Originally posted by harshmaul
              Hi,
              I have to agree qith ronver, we can only suggest ideas, we can't solve your problem without some code that you have written.

              Please post the code you have made?

              If you haven't made anything yet please start now...



              This link will get you started, And if you ask ronver nicely he might be able to find you a thread of an admin login thing he did which is top quality
              Thank you harshmaul. You flatter me.

              Ronald

              Comment

              Working...