I need a simple authentication script, here are the details:
I do NOT need an admin interface, signup section, anything like that. This will be just a component of a larger system so I will handle the creation of usernames/passwords/authentication levels. What I need it to do is as follows:
A login form that submits the login data (username and password) and checks it against a database which contains the following fields: username, password, level, name.
I will make the entries into the database manually for now, the script does NOT need to create usernames, passwords, or authentication levels.
After checking the credentials against the database it will generate a cookie that will reside on the users system. An option to make cookie permanent (i.e. 'keep me logged in') will be available to the user on the login form.
The second part of the system will be a php file to include on every page that will check the cookie, if no cookie is present it will send the user back to the login form, if the cookie is present it will verify that the page they are on is one they are authorized to be on (i.e. the 'level' indicator in the database, if not it will boot them back to their main page.
Each 'level' designater in the database will point to a specifc main page. For now there will be three 'area designaters' user,admin,reader so when a person logs in if they are classified in the level 'user' it will direct them to the [url removed, login to view] page, admin to the [url removed, login to view] page, and reader to the [url removed, login to view] page. The 'level' designation is just so that I can reference on a given page if a person is logged in or not.
The 'name' field should be stored in the cookie as well, and there should be a function I can include on the pages that will display the users name which is stored in the cookie.