ecabrera Posted April 9, 2012 Share Posted April 9, 2012 ok im trying to create a admin panel but i want to be able to set what level of power they have how would i start i know that i have to use a enum Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/ Share on other sites More sharing options...
chriscloyd Posted April 9, 2012 Share Posted April 9, 2012 well it depends you can do a permissions system Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335489 Share on other sites More sharing options...
freelance84 Posted April 9, 2012 Share Posted April 9, 2012 If you are writing your app from scratch... In your database, in your members table insert a column titled 'type'. Against each admin insert the number you wish to represent admin, eg 1.. for your other non admin members insert say 5... The reason I say 5 and not 2 is to allow your app to grow at a later date... EG you may wish to insert different levels of admin at a later date which may want to hold value 1 to 4... Then in your authenticate script, set a session according to the type filed in you members table. Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335490 Share on other sites More sharing options...
ecabrera Posted April 9, 2012 Author Share Posted April 9, 2012 Ok but should i set it as a enum and would the line of code work to see if there are that level Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335492 Share on other sites More sharing options...
ecabrera Posted April 9, 2012 Author Share Posted April 9, 2012 anyhelp Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335506 Share on other sites More sharing options...
litebearer Posted April 9, 2012 Share Posted April 9, 2012 tiny int is fine. could use conditional if's or could use switch to A) access certain pages or B) to display various menus etc etc Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335510 Share on other sites More sharing options...
ecabrera Posted April 9, 2012 Author Share Posted April 9, 2012 ok so can a tiny int hold 4 number becaucse i want it like 1 user 2 staff 3 admin 4 banned Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335523 Share on other sites More sharing options...
KevinM1 Posted April 9, 2012 Share Posted April 9, 2012 Have you tried looking up what a tinyint is in MySQL? Seriously, it's faster for you to do 30 seconds of research on something like this than to wait for someone else to provide you the answer. Quote Link to comment https://forums.phpfreaks.com/topic/260581-levels/#findComment-1335525 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.