PHP Includes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to include a file that contains a variable $app_title;

However, if I use the following code:

$base = "http://".$_SERVER['HTTP_HOST']."/application_folder/";


The variable is not found.

If I use this code:

$base = "http://".$_SERVER['HTTP_HOST']."/application_folder/";

include('definitions.php'); // $base removed

Then I can access the variable.... has anyone else experienced this. I
have checked my PHP.ini file and I have allowed http:// includes

Re: PHP Includes

On Wed, 05 Mar 2008 20:19:26 +0100,  =

Quoted text here. Click to load it

1) Both allow_url_fopen & allow_url_include have to be on for a succesfu=
ll  =

include by http.
2) On an include over http, requesting a PHP file, the file will almost =

certainly be run instead of served, i.e. the code is processed, what you=

are including is about the same thing you'll get when watching it in a  =

browser. Offcourse, rename it to definitions.txt and it would work.
3) If you have the option to include by the file system, never, never,  =

never include by http. Never, I can't stress that enough. Never...
-- =

Rik Wasmus

Re: PHP Includes

Quoted text here. Click to load it

Thanks Rik! I've just done it without using a http:// include as you


Re: PHP Includes

On Mar 5, 4:17=A0pm, ""
Quoted text here. Click to load it

the HTTP_HOST, comes from the Host header, which shouldn't be trusted.
as it can be faked, successfully taking over your domain.

btw where is this code uploaded? (hehehe)

Site Timeline