> There is a way to supposedly do this by authenticating > a username and password through php first through such > methods as database lookups and then passing the > username and password through $PHP_AUTH_USER and > $PHP_AUTH_PW using the header() command to point to the > URL of the .htaccess protected directory but I have > never gotten it to work myself.
The variables $PHP_AUTH_USER and $PHP_AUTH_PW are available to you when the user authenticates via HTTP basic authentication. Thus, the user has already had to type in the username and password into a separate window, which is what the original poster is trying to avoid. To then send the user to another URL and supply the authentication credentials in the URL itself just creates an unnecessary step. > There isnt any PHP pages directed towards teh directory > itself. Its is just a hard link to the protected areas. > Are there any functions that support it? > > Im googling now ;) I'm still having a bit of trouble interpreting your question, so Google might have a hard time, too. :-) If you are protecting static resources such as images and HTML files with your Web server currently, the only way to protect these with PHP is to store them outside of the document root (so that your Web server cannot serve them directly) and serve them with PHP (using header("Content-Type: whatever")) once you have determined whether the user should be allowed to access the particular resource. Hopefully that can help refine your search. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php