Advertisement

06.30.2008 at 10:46AM PDT, ID: 23527695
[x]
Attachment Details

Best Way to Protect Directories

Asked by rowejd in PHP Scripting Language, PHP and Databases, MySQL

Tags: PHP

I want to provide file downloads to users of my web application.  Different user-levels or accounts will be allowed to access different directories/files.

I know I can use .htaccess, but I don't want them to log in to my app and THEN have to type in a username & password again to unlock a directory.  Is there a way to have PHP pass .htaccess username & password?  I don't think there is.  I know you can use a URL to pass username/pw to .htaccess, but I hear that's not secure either.

I also know I could use MySQL to store the binary data (files) and write queries to allow permissions to view/download certain ones.  But a php guru I respect highly says never to store files in your MySQL db - but to just use it to point to directories...which again leads me back to the problem.  If I'm just supplying directories via MySQL, then anyone can read those if they just "guess" or if another customer gives them the directory name.

So what's the best way to protect directories & files using PHP (and maybe MySQL too?).Start Free Trial
[+][-]06.30.2008 at 11:04AM PDT, ID: 21901440

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, PHP and Databases, MySQL
Tags: PHP
Sign Up Now!
Solution Provided By: virmaior
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.30.2008 at 12:13PM PDT, ID: 21902131

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 12:20PM PDT, ID: 21902197

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 12:27PM PDT, ID: 21902262

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628