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 Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261063 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. Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261065 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 Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261074 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 Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261144 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? Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261234 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 Link to comment https://forums.phpfreaks.com/topic/52752-would-an-array-do-the-trick/page/2/#findComment-261241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.