rofl90 Posted March 25, 2008 Share Posted March 25, 2008 I'm building user types eg admin, news editor, page editors etc heres my current logic: in the users tbl we have columns with the names of each administrators page, in each page 1 is able to look at it, 0 being not able then we have something in the config file saying <?php // queries etc if($row['someAdminPage'] == '1') { $someAdminPage = "1"; } else { $someAdminPage = "0"; } // repeat for all pages ?> I get the feeling this is not efficient.. My other question is about decided, I was thinkign select's would be easier on me, but thats lazy! And checkboxes are easier on the user, so do i use checkbox's just like text's to validate them with $someCheckBox = $_POST['someCheckBox']; or do i need to do a switch or whatever. Thanks for taking the time to read all this. - Happy Easter - Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/ Share on other sites More sharing options...
rofl90 Posted March 25, 2008 Author Share Posted March 25, 2008 Anybody? I've got to start coding it now, and don't really want to go back with mistakes, lol, anything more efficient? Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500106 Share on other sites More sharing options...
rofl90 Posted March 25, 2008 Author Share Posted March 25, 2008 Anyone share their systems logic for user groups? Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500115 Share on other sites More sharing options...
rofl90 Posted March 25, 2008 Author Share Posted March 25, 2008 /bump Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500695 Share on other sites More sharing options...
rofl90 Posted March 25, 2008 Author Share Posted March 25, 2008 Hmm, is this a good way, would you recommend it to me? Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500729 Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 Continually bumping yourself will not get you an answer. Your method is fine, assuming you don't have many admin pages. With a lot of pages, I'd suggest an advanced grouping method, using user groups, and page groups.. or for pure page-by-page customizability, storing per-page access levels in an array and serializing it, or creating a custom serialize-like function. Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500742 Share on other sites More sharing options...
laffin Posted March 25, 2008 Share Posted March 25, 2008 Most systems use number based values for user levels User = 1 Moderator =5 Editor = 10 Admin = 20 than doing comparison checks for the user level is pretty basic comparison. but if ya want lots more flexibility. u will want to look into bit flags for different activities (Note values are power of 2) Read = 1 Post = 2 Delete = 4 Hide = 8 Edit = 16 and using bit testing to see if a user can preform that action or not, a lot more complex, offers more flexibility. Quote Link to comment https://forums.phpfreaks.com/topic/97732-hazy-logic/#findComment-500751 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.