Re: restricting access to files using PHP
| From: | Shams | Date: | Thu, 13 Feb 2003 10:19:57 +0000 |
| Subject: | Re: restricting access to files using PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135402@lists.php.net to get a copy of this message | ||
Ooops, I didn't mean to post my question a number of times! Just that my
message didn't appear (in Outlook Express), so I reposted it. Thanks to
everyone who replied.
I'd rather not convert .HTML files to .PHP files because there are other
files in the members area that I also wish to protect (.DOC and .PDF files).
I'm interested in your solution David, what is the format of the external
auth script that you use.. is there some kind of return you have to give
.htaccess ?
Also, is there no way I can allow a user to login using a PHP login script,
and then pass the "username" and "password" over to .htaccess to verify ?
Thanks for the help,
Shams
"David T-G" <davidtg-php@justpickone.org> wrote in message
news:20030212124820.GZ55110@justpickone.org...
You've seen the suggestions from others to change your .html files. You
may or may not want to do that.
If you don't want to do that, then you need a .htaccess file. You don't
necessarily, however, need a .htpasswd file as well; just make your php
script the authenticator:
AuthName AccessYourDirectory
AuthType Basic
AuthExternal /path/to/your/script
order allow,deny
allow from all
require valid-user
This is untested code, but you get the idea. You may have to define your
external auth script with some name and then call it; our version of this
uses NickName instead of /path/to/your/script and in the httpd.conf file
we have
AddExternalAuth NickName "/path/to/script"
SetExternalAuthMethod NickName pipe
and I dunno if 1) adding and nicknaming is necessary or 2) you can do it
in a .htaccess file instead of having to put it in the http.conf file.
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!