I think he's talking about using PHP to do apache level .htaccess authentication. I'm trying to figure out how to do the same thing; here's why:
I would like to control access to ANY file in a directory tree. Normally, I would create an .htaccess file for the root directory I want to protect and add users to that list using htpasswd, but I already have a user login database and authentication module I have written with PHP with existing users and would like to be able to use those username/passwords for complete directory access to certain directories using the same security as .htaccess. Can I do this with PHP somehow?
I've thought of having a script that populates the .htaccess file for that directory structures with users who are permitted then use the environment variables to preset the user to the currently logged in user. Haven't tried anything yet... =)
Jt