Forum Topic: PHP Includes?

(172 views • 10 replies)

This topic is 1 page long.

<< < > >>
Shouting

bgraybr

Reply To Post Reply & Quote

Posted at: 6/10/09 02:44 PM

bgraybr DARK LEVEL 09

Sign-Up: 06/30/08

Posts: 2,167

Link

I tried to use PHP (PHP 4) includes on my website to make things easier- but when I went to test it the page it was covered in errors.

I'm using this code:

<?php include("url"); ?>

What did I do wrong?

The following sentence is true. The previous sentence is false. O_o PARADOX!
Linux Users Club | Linketylinklinklinklink...


None

citricsquid

Reply To Post Reply & Quote

Posted at: 6/10/09 03:00 PM

citricsquid DARK LEVEL 23

Sign-Up: 06/25/05

Posts: 16,128

you can only include from the same server and in the same web root, so

<?php include ("folder/file.php"); ?>

will work, if you want to include external files you use file_get_contents.


None

bgraybr

Reply To Post Reply & Quote

Posted at: 6/10/09 03:27 PM

bgraybr DARK LEVEL 09

Sign-Up: 06/30/08

Posts: 2,167

At 6/10/09 03:00 PM, citricsquid wrote: you can only include from the same server and in the same web root, so

<?php include ("folder/file.php"); ?>

will work, if you want to include external files you use file_get_contents.

I put all of the includes in a different directory but its in the same server/web root.
Ex.
<?php include("http://www.randomns013.com/incl udes/navigation.php"); ?>

The following sentence is true. The previous sentence is false. O_o PARADOX!
Linux Users Club | Linketylinklinklinklink...


None

Wonderful

Reply To Post Reply & Quote

Posted at: 6/10/09 03:30 PM

Wonderful FAB LEVEL 13

Sign-Up: 07/27/08

Posts: 854

The include parameter has to be relative, i.e. you can't use full URL's like that.

Posted from Linux. Distro may vary.


None

citricsquid

Reply To Post Reply & Quote

Posted at: 6/10/09 03:32 PM

citricsquid DARK LEVEL 23

Sign-Up: 06/25/05

Posts: 16,128

At 6/10/09 03:27 PM, bgraybr wrote: <?php include("http://www.randomns013.com/incl udes/navigation.php"); ?>
<?php include("includes/navigation.php"); ?>

You can't use full URLs...


None

VigilanteNighthawk

Reply To Post Reply & Quote

Posted at: 6/10/09 03:33 PM

VigilanteNighthawk LIGHT LEVEL 03

Sign-Up: 02/13/03

Posts: 1,686

You use the path on the file system to include the file, not the url.


None

urbn

Reply To Post Reply & Quote

Posted at: 6/10/09 08:59 PM

urbn FAB LEVEL 18

Sign-Up: 06/10/07

Posts: 2,302

I'll say it as well...

You can't use full URL's!

BBS Signature

None

liljim

Reply To Post Reply & Quote

Posted at: 6/11/09 09:03 AM

liljim NEUTRAL LEVEL 27

Sign-Up: 12/16/99

Posts: 8,913

You can use full URLs (in 4.3.0 +) if allow_url_fopen is enabled, though of course, the information in the page is already parsed at that point.

BBS Signature

None

urbn

Reply To Post Reply & Quote

Posted at: 6/11/09 11:41 AM

urbn FAB LEVEL 18

Sign-Up: 06/10/07

Posts: 2,302

At 6/11/09 09:03 AM, liljim wrote: You can use full URLs (in 4.3.0 +) if allow_url_fopen is enabled, though of course, the information in the page is already parsed at that point.

While this is an perfectly valid point, I would suggest for someone who can't work out includes to just have the sweeping statement mentioned above ;)

BBS Signature

None

henke37

Reply To Post Reply & Quote

Posted at: 6/11/09 12:21 PM

henke37 NEUTRAL LEVEL 23

Sign-Up: 09/10/04

Posts: 3,671

It's inefficient, will do the parsing twice, and is often disabled due to most of the time, it's only used to exploit other people.

Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.


None

liljim

Reply To Post Reply & Quote

Posted at: 6/11/09 12:42 PM

liljim NEUTRAL LEVEL 27

Sign-Up: 12/16/99

Posts: 8,913

At 6/11/09 12:21 PM, henke37 wrote: It's inefficient, will do the parsing twice, and is often disabled due to most of the time, it's only used to exploit other people.

I didn't say it was a practical thing to do, I was just disputing those who said you can't do it.

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 02:38 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!