Page 1 of 1
URL view by User Level
Posted: Thu Oct 27, 2005 3:23 am
by spudmclard
Is there a way to display URLS depending on user access level.
I have a MySQL database holding Username/Password/Userlevel.
Is it possible when the user has been validated that their access level is checked and then the relevant URLs are displayed.
ie..
User1 access level1 -Url A
User2 access level2 -Url A & Url B
USer3 access level3 -UrlA & UrlB & UrlC
Thanks
Posted: Thu Oct 27, 2005 7:55 am
by Grim...
Er...
Code: Select all
<?php
if ($userlevel >= 1)
{
print "<a href="blah.php">This</a>";
}
if ($userlevel >= 2)
{
print "<a href="blah2.php">This2</a>";
}
// etc...
Better, actually, to use a
switch(), but I'll leave you to look at that yourself...
Posted: Thu Oct 27, 2005 8:30 am
by n00b Saibot
Code: Select all
Table Name - apps /*stores application & access rules*/
| id | name | url | access_level |
| 01 | Bond | http://van-dame.com/1 | 1 |
| 02 | Pond | http://van-dame.com/2 | 2 |
| 03 | Cond | http://van-dame.com/3 | 3 |
does that give you
edit: btw the last entry (3) will show in both levels i.e. 1 & 2 ( 1|2 = 3

)
Posted: Thu Oct 27, 2005 8:33 am
by Grim...
Doesn't he need all three urls for people with level 3 access?
Posted: Thu Oct 27, 2005 8:40 am
by n00b Saibot
see my edit. i think i will explain more...
i store permissions in bits-form (saves space

)
i.e.
> lowest level - 1
> middle level - 2
> top level - 4
therefore
> links for all - 4|2|1 = 7
> links for med & top - 4|2 = 6
> links for top & lowest - 4|1 = 5
in this way i can easily isolate any two levels without having to implement extra checks

Posted: Fri Oct 28, 2005 3:27 am
by spudmclard
Thanks everyone..Gives me plenty to work on
