Re: Preventing execution without inclusion
| From: | Josh Whiting | Date: | Fri, 14 Jan 2005 15:33:46 +0000 |
| Subject: | Re: Preventing execution without inclusion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206384@lists.php.net to get a copy of this message | ||
> as per PHP5 example
>
> 1 (the preferred way): user accesses
> http://www.example.org/index.php?function=Join, this loads the
> class
> NewUser and begins its implementation. Because of the __autoload, it
> includes class.join.php, in order to utilize the class.
>
> 2 (the wrong way): user accesses
> http://www.example.org/includes/class.join.php without going
> through
> index.php.
>
> I am trying to prevent 2 from even occuring, utilizing a piece of code
> that would check if index.php had included it, or not. This code would
> be in the beginning of all the class files, at the top, before any other
> code was to be executed.
>
> As of yet, it has eluded me...
Put the include file outside the web directory tree.
/jw