I already have an existing login system using php and mysql using sessions. I think i do not need to post the code here.
i want to add a user level feature to it, wherein it limits the pages that can be viewed by a registered user depending on his access level. Example user level 1 can can access pages 1-5 only, and user level 2 can access pages 1-10, and so on.
i addedd a userlevel column on my members table. and i do not know what is the next step.
what particular function / code can be used to set the user level restrictions on the pages?
i tried searching out for examples in the web but can’t find any good one.
please help
You haven’t given me much information as to what’s happening (Maybe that’s why your username is PHPNewbie).
What I
didhave done with a previous user system of mine is I had a separate table called groups. In the groups table it had boolean values of different privileges in columns (such as canComment). Whenever I needed to verify if a user could perform an action, I just checked for a true value in action’s column.You could implement this by having a broader user system, where an integer userLevel could indicate the group of the user (0 – root, 1 – basic etc.). What it appears you want is a page restriction system. I can suggest you use a switch statement that retrieves the userLevel as so –