Password Protected Area newbie question :)

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
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Password Protected Area newbie question :)

Post by lazersam »

Hi all

I am new to PHP and learning it slowly. My project at the moment is to create a password protected directory that only members can access.

So far I have a log in page that users input their username and password. That is submitted to an authenticate php script that matches the entries with database entries.

My question is what do I do next? I have a .htaccess file in the directory, how do I tell it to let my user in? Can someone advise?

Regards


Lawrence.
User avatar
dyconsulting
Forum Newbie
Posts: 14
Joined: Mon Dec 01, 2003 6:52 pm
Location: San Francisco

Post by dyconsulting »

If you are using database to authenticate user you might think about not using .htaccess file. I would just see if I have an entry in db (username and password), store that userid on session or in the cookie and redirect to logged in page.
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

Thanks Dmitry - I have rewritten my script to start a session if the username and password are found in the same row in the database.

The only problem is that my site offers downloads for members only, is there anyway I can protect the download files from unauthorised access?

Thanks for your help

Lawrence
Post Reply