I have a password protection for my website. The LogIn name and passwords are stored in a mysql database.
My question is: How can I define that a person who has a LogIn can only see some pages of the whole website? How can I connect the information about which pages the user is allowed to see with its LogIn information? In mysql as well as in my php programmed website?

Recommended Answers

All 3 Replies

Just check to see if they are logged in on the pages they can only see when logged in. A simple cookie check can do this.

i think what you're talking about are called 'permissions'. you want certain users to have perission to only certain pages. i'm not sure how to do this, as i've never done it myself. but i would start with handling 'sessions'. check 'em out. www.php.net/session

You could maybe add new columns to the database. eg.

username, password, section 1, section 2, section 3.

Where section 1, 2, 3 would define different levels of access. If the user were allowed access to section 2 the value stored in the database could be 1. If they weren't allowed then you could put a value of 0.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.