""Daniel Brown"" <parasane@xxxxxxxxx> wrote in message
news:ab5568160801160907xa2525actd211b48e23f55e56@xxxxxxxxxxxxxxxxx
On Jan 16, 2008 12:02 PM, Jim Lucas <lists@xxxxxxxxx> wrote:
Jim Lucas wrote:
> Wolf wrote:
>> I'm using .htaccess to do
>> php_value auto_prepend_file "auth.php"
>>
>> The problem is that there are very specific files that I want to be
>> able to NOT run that in. I guess I could just move them to a
>> directory and use .htaccess to perform a php_value auto_prepend_file
>> ""
>>
>> But I was hoping to not have to make a separate folder for that.
>> Anyone encoutered being able to change/disable the setting on the fly
>> in a specific file?
>>
>> Thanks!
>>
>> Wolf
>>
>
> Just had an interesting way of solving this problem come to mind.
>
> I would like others to way in on this.
>
> You can do this completely from within apache.
>
> For the pages that you want to have auth.php included with, give them
> and extension of .phtml or something else...
>
> Then, configure apache to allow php to process those like this
>
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php .phtml
>
> then in apache, could be in httpd.conf or .htaccess have something like
> this.
>
>
> <Files .phtml>
> php_value auto_prepend_file "auth.php"
> </Files>
>
> When finished, restart apache and you should be good to go.
>
> I would try something like this. Should work, others might have better
> ideas.
>
Now that I am looking at this a second time. Couldn't all this apache
stuff be done in the .htaccess file?
Just place all the following in a .htaccess file, then change the
extension on the file(s) that you want to have work this way. I don't
think you need to touch the httpd.conf file at all.
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
<Files .phtml>
php_value auto_prepend_file "auth.php"
</Files>
Then all of the links or includes would have to be updated to
handle the .phtml extension change, too. Good idea, but it sounds to
be like what he's asking unfortunately just isn't possible without
some form of major overhaul.
--
</Dan>
Well, at least it will be usefull next time someone does a project in which
they want to auto-add a header, or some authorization code.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php