On Jan 16, 2008 11:33 AM, Wolf <[EMAIL PROTECTED]> wrote:
> ---- Daniel Brown <[EMAIL PROTECTED]> 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].

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to