Re: htaccess question
| From: | Shawn McKenzie | Date: | Fri, 11 Sep 2009 15:15:44 +0000 |
| Subject: | Re: htaccess question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297912@lists.php.net to get a copy of this message | ||
tedd wrote:
> Hi gang:
>
> Is there a way I can use a htaccess directive to require a php script to
> be "included" within each file contained within that directory?
>
> For example, let's say I have a directory with 100 scripts in it, but I
> want each script within that directory to pass through an authorization
> script before executing.
>
> The hard way is for me to go through each of the 100 scripts and add the
> statement "require(auth.php)", but I don't want to do that (I'm too lazy
> and beside there is too great of a chance of an error). So, is there a
> way for me to circumvent this problem by using a htaccess directive?
>
> Now, I know that I can use htaccess to require basic authorization, like
> so:
>
> AuthType Basic
> AuthName "admin"
> AuthUserFile /home/httpd/vhosts/mydomain.com/.htpass
> require valid-user
>
> But I don't want a file containing user ids and encrypted passwords in
> the file system. Instead, I want to move the user ids and passwords into
> the database and out of the file system. I can do this with an
> authorization script, but I don't want to alter 100 scripts to do it.
>
> Opinions and suggestions welcomed.
>
> Thanks,
>
> tedd
.htaccess
php_value auto_prepend_file "/path/to/auth.php"
--
Thanks!
-Shawn
http://www.spidean.com