PHP file permissions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asp30
Forum Newbie
Posts: 3
Joined: Fri Mar 27, 2009 8:27 am

PHP file permissions

Post by asp30 »

I have created web pages for different user students and lecturers but I want to limit the access the users have to the web pages, I want the users to access only some pages, can you please help me how I can permit and restrict access to the pages, I have already created my register and login.
Thanks everyone
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP file permissions

Post by Christopher »

Do you only want each user to be in one group? Or will you need users to have multiple roles? Are you limiting users to whole pages, or will you also limit them to parts of pages?
(#10850)
asp30
Forum Newbie
Posts: 3
Joined: Fri Mar 27, 2009 8:27 am

Re: PHP file permissions

Post by asp30 »

I have two users’ students and lecturers, I want the lecturer to view three pages and the student has 2 pages to view and they shouldn't view each others pages, and its whole pages not part.
Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP file permissions

Post by Christopher »

Simplest would be to add a field to your database table of users (maybe called something like 'access' or 'group') that could be set to the value 'student' or 'lecturer' (or 1, 2). The on each page check that column value to see if the user is allowed access.
(#10850)
Post Reply