Forum Moderators: coopster

Message Too Old, No Replies

link differs with access level

         

stafinskijm

12:29 am on Jan 2, 2005 (gmt 0)



How would I go about making a link point to a different page based on the access level that the user has. The page that the link would be on already displays the user information and their access level, so i can use it as a variable. I just don't know how to go about writing the code that would make the link change depending on wheter access level=1, 2, or 3.

Nutter

1:58 am on Jan 2, 2005 (gmt 0)

10+ Year Member



I'm using something similar on one of my sites. What I would suggest is to use powers of 2 (1, 2, 4, 8, etc) so that you can do bitwise comparisons. That way you can use
if ($permission & CONSTANT_FOR_PERMISSION_TO_CHECK)
{ //Do something here }

A switch case would work as well. Basically, you just need to check for the permission level before outputting anything. I would suggest a session variable that is stored during your login validation and cleared when the session dies.

- Ryan