Re: Password Protect Directory

From: Date: Wed, 07 Mar 2007 15:10:13 +0000
Subject: Re: Password Protect Directory
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249986@lists.php.net to get a copy of this message
Jason Karns wrote: > I'm trying to find a way to password protect a directory. I currently have > an authentication and authorization system in place for pages in my > directory. I'd prefer to use my existing system somehow (as it includes > OpenID authentication) as opposed to using htaccess and HTTP Auth. The > only > idea of found is to use mod_rewrite to have a PHP script serve up all the > files in the particular directory and have the authentication handled in > this script. This just seems a little 'hackish' to me. why? as an alternative you could setup apache to force php to handle *all* files in that directory using a Files directive inconjunction with a auto_prepend_file directive for that dir that does the authentication and pumps out the requested file - same affect as using mod_rewrite without actually using mod_rewrite. > Is there any other > way to password protect a directory with PHP? I'd even entertain the idea > of using HTTP Auth if I could get PHP to 'login'. For instance, the user > logs in at another page in the site, and then during the login process, PHP > sets the HTTP Auth password so when the files in the directory are > accessed, > the user has already been logged in. > > Any suggestions would be great, I can't find anything else online. >

« previous php.general (#249986) next »