|
Posted by Didier Willame on 11/06/05 17:11
Thank Oli :) /didier
Oli Filth wrote:
> Didier Willame said the following on 06/11/2005 10:58:
>>
>> Janwillem Borleffs wrote:
>>
>>>Didier Willame wrote:
>>>
>>>
>>>You cannot use include/include_once this way when the extension is .php
>>>as it will only return the parsed result (an empty string in your case).
>>>
>>>What you can do, is save the class file with a .txt extension, after
>>>which you would be able to include it over HTTP:
>>>
>>>include_once 'http://yoursite/Foo.txt';
>>>$foo = new Foo;
>>>$foo->hello();
>>>
>>>Of course, this implies that Foo.txt will be world readable, unless you
>>>take precautions like shielding it with an IP based restriction.
>>>
>>>JW
>
> The best solution would be to *not* include the file via an HTTP
> request, instead just treat it as a local file.
>
> i.e. instead of:
>
> include_once 'http://yoursite/Foo.txt';
>
> use:
>
> include_once '../inaccessible_directory_below_web_root/Foo.txt';
>
> That way, it's impossible for anyone to access the PHP code from their
> browser.
>
>
> Oli
[Back to original message]
|