Jump to content

how to?


tauchai

Recommended Posts

i mean if there is any coding to disable the button or gray it out which is easiet way...assigning different access level is ok..but the view/menu item for the normal user is just little..just 1 or 2..so it is better for me to gray it out and all user share all menu item, with normal user,some menu item is not accessible by gray out or disable the button..
Link to comment
https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43911
Share on other sites

[!--quoteo(post=382116:date=Jun 9 2006, 08:04 PM:name=chai)--][div class=\'quotetop\']QUOTE(chai @ Jun 9 2006, 08:04 PM) [snapback]382116[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don have idea to disable some of the menu on the topbar...meaning normal user should not able to access to the menu item...only for administrator. But How to disable it or gray the button out so that is notclicakbe for normal user?

is it need Javascript or wat?

plz help.

thxs a lot! :)
[/quote]

to make it gray out you need javascript something like this!
[code]<script type="text/javascript">
function alertId()
{
document.getElementById("B1").disabled=true
}[/code]

to make it if its not the admin do something like this

if($user != admin)
{
\\javascript somehow
}
Link to comment
https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43924
Share on other sites

yes, that will work..up until the user decides to disable javascript.

you need to make a condition based on the user's level, and echo the link either as a link if admin level, or else a gray font color plain text for the user.

how you would actually go about implementing this depends entirely on how the rest of your code is setup. but basically it would look something like this:

[code]
//at some point in time before this, you would establish
//$user_level as the user's level. let's say for argument's
//sake level 1 is user, and level 2 is admin

if ($user_level == 2) {
  echo "<a href='blah.php'>blah</a>";
} else {
  echo "<font color='gray'>blah</font>";
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43939
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.