TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Log-in with access type (http://www.talkphp.com/absolute-beginners/5366-log-access-type.html)

ricarubio 03-22-2010 04:31 PM

Log-in with access type
 
Hi can someone help me with this problem.

I have two username and password with an additional field called access level.
For the sake of this explanation lets call them:
admin - abc password - page1.php and page2.php
guest- xyz password - page2.php

I have a page called 'index.php' wherein i will input my username and password. I also have a 'page1.php' and 'page2.php'I want the admin to access 'page1.php' and 'page2.php'.. While the guest can only access the 'page2.php'.

delayedinsanity 03-22-2010 06:40 PM

This is a rather enormous question by itself. Have you made any headway into setting the script up? If so, you may have better luck asking questions to specific to the stage of development you are currently in. We won't write the entire script for you, so we need to have some angle to approach in helping you.

You're going to want to look into form handling to start. That includes checking values for integrity and correct types. Then you're going to want to learn how to use sessions and/or cookies to maintain the information for a logged in user.

codefreek 03-22-2010 07:35 PM

ricarubio, Posting in two different sections.
Wont get you help faster. So please choose one section and stick to that one.

Thank you.

adamdecaf 03-24-2010 02:48 AM

A simple way of doing this would be to store the admin information in a database (or file if you don't have access to a database). Then on the index.php (or what ever page is loaded by default) check to see if the user has a cookie (a small bit of information that is can be stored on each connecting computer) with a correct [pseudo]random string.

If the strings match you can assume that the connecting user has either copied the data or is an admin. If the user appears to be valid you could send them to page1.php (where you would want to validate again) or if they don't then off to page2.php.

If you have any specific questions (or about the flow of a basic authentication system) don't hesitate to ask.


All times are GMT. The time now is 02:25 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0