Barand Posted May 24, 2007 Share Posted May 24, 2007 view column would hold the $perms in the above example. When a user logs in, get and store their $userlevel. In the query SELECT ... WHERE view && $userlevel Quote Link to comment Share on other sites More sharing options...
penguin0 Posted May 24, 2007 Author Share Posted May 24, 2007 Oh, now I get it. I thought at the top you were adding them. Now I see thats where you declare who can view it. Quote Link to comment Share on other sites More sharing options...
penguin0 Posted May 24, 2007 Author Share Posted May 24, 2007 If you are a pageman with a level of 16 can you view things that require: $menuman or $userman or $rateman Quote Link to comment Share on other sites More sharing options...
Barand Posted May 24, 2007 Share Posted May 24, 2007 Oh, now I get it. I thought at the top you were adding them. Now I see thats where you declare who can view it. Both. [pre] admin = 32 = 100000 pageman = 16 = 010000 menuman = 8 = 001000 userman = 4 = 000100 rateman = 2 = 000010 user = 1 = 000001 [/pre] if perms is admins, pagemans and menumans only then perms = 111000 So you only have permission if your particular "1" is in there Quote Link to comment Share on other sites More sharing options...
penguin0 Posted May 25, 2007 Author Share Posted May 25, 2007 what would I actually store in the db as the users perms? Should it just be 32, 16 or somthing else? Quote Link to comment Share on other sites More sharing options...
Barand Posted May 25, 2007 Share Posted May 25, 2007 The sum of the userlevels of those allowed to view it If it's users and admins only, then 33 (32 + 1) If everyone then 32+16+8+4+2+1 = 63 Correction to previous post (just a single "&"): SELECT ... WHERE view & $userlevel Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.