Re: changing the ini from a file
| From: | Daniel Brown | Date: | Wed, 16 Jan 2008 16:40:20 +0000 |
| Subject: | Re: changing the ini from a file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267399@lists.php.net to get a copy of this message | ||
On Jan 16, 2008 11:33 AM, Wolf <lonewolf@nc.rr.com> wrote:
> ---- Daniel Brown <parasane@gmail.com> wrote:
[snip]
> > At that point, wouldn't it be just as easy to <?
> > require('auth.php'); ?> as the first line of each file you want it in,
> > and omit the line in those you don't? Or are there a lot of files?
> >
> > --
> LOTS of files, hence wanting to do it sporadic, mostly just for diagnostic pages.
>
> I can always just drop them and use the .htaccess to disable the prepend for that folder/files
> but was wondering if I could do it on the fly.
>
> Seems like the prepend can't but figured I would check with the folks here before I
> completely gave up.
If it's strictly for testing purposes, you could use a switch to
include a file. This is NOT SAFE, and NOT SANITIZED, so read it as a
DISCLAIMER: NOT FOR PRODUCTION USE. Just to get that out of the way
for the lawyers out there. Not clean, not pretty, not anything more
than a hack job. Maybe a suggestion that could lead you to a better
idea though.
<?
$prepend_to = array(
'file1.php',
'file7.php',
'file12.php',
'file14.php',
'file46.php',
'file134.php');
if($_GET['incfile']) {
if(in_array($_GET['incfile'],$prepend_to)) {
include('auth.php');
}
include($incfile);
}
?>
--
</Dan>
Daniel P. Brown
Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since
Nineteen-Seventy-[mumble].