By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

Change Left side menu according to user type

100+
P: 250
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?
Feb 15 '08 #1
Share this Question
Share on Google+
6 Replies


harshmaul
Expert 100+
P: 490
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

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $varAccess = 1;
  3.  
  4. switch ($varAccess)
  5. {
  6. case 1:
  7.   echo "Link 1";
  8.   echo "Link 2";
  9.   echo "Link 3";
  10.   echo "Link 4";
  11.   break;
  12. case 2:
  13.   echo "Link 1";
  14.   echo "Link 2";
  15.   echo "Link 4";
  16.   break;
  17. case 3:
  18.   echo "Link 1";
  19.   break;
  20. default:
  21.   echo "Please Login";
  22. }
  23. ?>
Feb 15 '08 #2

ronverdonk
Expert 2.5K+
P: 4,258
Since you do not show any code, I'll guess.
[php]
if ($user_authorization == 9) { // admin
echo '<a hef="admin_menu.php">Link 1</a>';
}
elseif ($user_authorization == 1) { // special user
echo '<a hef="special menu.php">Link 2</a>';
}
else {
echo '<a hef="normal_menu.php">Link 3</a>'; // normal user
}
[/php]
If you do not show the code, that's all I can show you.

Ronald
Feb 15 '08 #3

100+
P: 250
Still confusing. May i need to use sessions?
Feb 16 '08 #4

ronverdonk
Expert 2.5K+
P: 4,258
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
Feb 16 '08 #5

harshmaul
Expert 100+
P: 490
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...

http://www.codersadvocate.com/blogs/...sposition_PHP/

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
Feb 16 '08 #6

ronverdonk
Expert 2.5K+
P: 4,258
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...

http://www.codersadvocate.com/blogs/...sposition_PHP/

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
Feb 16 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.