Displaying same page differently for users with different roles

Viewed 2845

I wanted some suggestions from someone with experience in php.

I am making a website in php which will have 4 kinds of users : 1. guest(unregistered), 2. registered, 3. registered with special privilages, 4. admins

So the same page will be visible differently to all four of them.

Right now I am doing that by using if conditions. In every page, I am checking the role of the user and then using many if statements to display the page accordingly.

It makes the code very big and untidy and I have to check conditions again and again in all the pages.

  1. Is there a better way to do this?

  2. How is this done in big professional websites?

  3. Extended Question: What is the most optimal way to do the same using a MVC framework like kohana 3.1? Does it have anything to do with acl?

1 Answers
Related