360 Posted November 4, 2009 Report Posted November 4, 2009 I'm currently working on a course project that involves a database-driven PHP script with user access features. I've never worked with PHP before and I'm currently working on the basics of the user authentication system. Can anyone guide me in the right direction in terms of how to process a login form to: - Check the details in the database - Create a session - Load certain values from the user table and store them as variables (one namely "user_type" which defines the privleges the user has) - Load content appropriate to that user type I current have in mind three different user types; an admin, staff and client. I want different content to be displayed on the page for each type. For example, I want the admin to have options to add and edit users and content for clients, while clients can only view and download the content given to them etc. 1
iBotPeaches Posted November 5, 2009 Report Posted November 5, 2009 Learn the basic if and switch statements in php. That should help cover displaying the right content to the user. As for checking details, it really can't be explained by me. You have to clean the incoming variable (for malicious code) then check that against the database. Its complicated if your starting from fresh. If you know nothing, I think Adobe Dreamweaver does that database thing for you. However, only do that to learn because its security and other features suck.
360 Posted November 5, 2009 Author Report Posted November 5, 2009 Learn the basic if and switch statements in php. That should help cover displaying the right content to the user. As for checking details, it really can't be explained by me. You have to clean the incoming variable (for malicious code) then check that against the database. Its complicated if your starting from fresh. If you know nothing, I think Adobe Dreamweaver does that database thing for you. However, only do that to learn because its security and other features suck. Alright, Thanks.
Dark Slipstream Posted November 5, 2009 Report Posted November 5, 2009 <?php if (!$_SESSION) { session_start(); session_register('loggedin'); } ?> That code initiates a session properly. You need to put this in a PHP file where you output a form to input login data. Use the post method to send the data to another php file to validate the login, then set loggedin = 1 or something.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now