Well, you could try to edit each PHP file and add a piece of login code at top, but if the directory will also contain images (which need a password to access), it would not be possible that way. Tijnema On 3/4/07, Jason Karns <karnsj@xxxxxxxxxxxxxxxxxx> 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. 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.