Hi,

I was wondering is there a way to password protect a directory. Here is my problem. My site require a login using php and mysql. This works, however I want to protect a certain directory that only lets a user who login previously to download files from it. I can keep non-user from viewing any other pages but they can still download a file via direct link. I want to stop this. I know I can use .htaccess files but that would require another login from the user. Is there a way to combine the two login into one? Thanks for your help in advance.

I think you may find something with a search on Google that would narrow your requirements down a little and possibly even provide an answer to your problem:

http://www.google.com/search?q=php+login

You may want to consider putting the directory for the downloads outside the web root on your server. That way, it can only be accessed through a program and that program can check the login info to see if the user has the authority to do it. You can do a search and get more info (I provided one link below). There are some considerations so do a bit of research.

http://www.bigresource.com/Tracker/Track-php-mKbF05IC/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.