User Access In PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Munnabhaai
Forum Newbie
Posts: 2
Joined: Thu Jul 14, 2011 8:25 am

User Access In PHP

Post by Munnabhaai »

Hi,

I am new to PHP and currently trying to develop a website. I have a few sections (pages) where Users must insert a Username and password to gain access to other pages. i want to use PHP for doing that.

e.g. loginstaff.htm - user has to enter Username & Password (this is being validated by a php script in login.php) to access staff.htm. I need the user to enter the proper Username & password used when registering and restrict any other people/user to type the URL directly (e.g. www.site.com/staff.htm).

Thanks
Munnabhaai
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: User Access In PHP

Post by Celauran »

What do you have so far? What problems are you encountering?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: User Access In PHP

Post by califdon »

Munnabhaai wrote:Hi,

I am new to PHP and currently trying to develop a website. I have a few sections (pages) where Users must insert a Username and password to gain access to other pages. i want to use PHP for doing that.

e.g. loginstaff.htm - user has to enter Username & Password (this is being validated by a php script in login.php) to access staff.htm. I need the user to enter the proper Username & password used when registering and restrict any other people/user to type the URL directly (e.g. http://www.site.com/staff.htm).

Thanks
Munnabhaai
First of all, in order to use PHP, you need to eliminate staff.htm and replace it with staff.php, which will contain all the html from staff.htm, but will have additional PHP code to control the access, etc. At least, I think that's the most obvious and efficient approach. So staff.php will initially present the user with a login form that has action='', which sends the Post form data back to the same script, which can then validate the login credentials against the database and either deliver the desired HTML or return the notice that the login was unsuccessful.
Munnabhaai
Forum Newbie
Posts: 2
Joined: Thu Jul 14, 2011 8:25 am

Re: User Access In PHP

Post by Munnabhaai »

califdon

thanks will start doing that and get back for more questions that i may have.

Thanks
Post Reply