-
Login!!
I've asked this before and am needing help on one last page!!
I have a members signup page where they sign up and have a user level of 0. I have to have a page which I can inlude on any page which will confirm they have logged in and if not kick them out of the login page and if they have then confirm if they are a user or admin... if a admin page then say you don't have the permissions!!
I have a sign up page done just want a auth.php page to do the above
-
-
I'm just going to assume you don't know how to do it and you are asking for direction...
This is psuedocode (more like plain english), but it'd go something like this:
Code:
auth.php
Connect to the Database
if cookies are set {
Query the database to validate cookie data
if cookie data is valid {
Store the username and permissions in a variable
} else {
clear the invalid cookies
take them to a login page
}
} else {
take them to a login page
}
Include this page at the top of every page.
In the admin page, query the permissions variable you created (say $CONFIG['permission']). If the value is 0, tell them they don't have permission to view the page. If it's 1 (or whatever you're going to have it as), show them the page.