Re: Security in included PHP files
| From: | Jacob Copsey | Date: | Thu, 16 Jan 2003 19:57:40 +0000 |
| Subject: | Re: Security in included PHP files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131925@lists.php.net to get a copy of this message | ||
This should work as long as you are only including your include files from
scripts named index.php.
--Jacob
"Philippe Saladin" <pheuh@yahoo.fr> wrote in message
news:20030116162456.43467.qmail@pb1.pair.com...
> > directly. My main question is if all of the code inside an included PHP
> file
> > is put inside one or more functions this should prevent anyone from
> running
> > any of that code by directly calling that PHP file correct? There is no
> way
> > for them to invoke a function just from a URL assuming I have no code at
> all
> > outside the functions.
> Just a small tip : to be *sure* that no one runs directly my included
files,
> they begin with
>
> if (basename($_ENV["SCRIPT_NAME"]) != 'index.php') {
> // redirection
> }
>
> So, even if the code is not in a function or class, I'm safe.
> Am I wrong or do you think it could be ok?
> Regards,
> Philippe
>
>