include and coding explosion

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

include and coding explosion

Post by tkarven »

Hi,

If we include a script from an external webpage, will that explode our origin script coding ?

Thanks in advance.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

In what way do you mean?

Literally make your machine explode? ( :P ) or have the same result as the function explode()?
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

Post by tkarven »

for example i got some page that get displayed from affiliate external website. of course one of the way is to use iframe but it will spoil the design of the whole webpage. So instead of it, i prefer to include externally to my existing page using coding like following ...

include("external_page.php");

shouldn't be any problems, but just to double confirm it .
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

That will fail, try using something like file_get_contents() instead :)

EDIT: Depending on what you want to do of course, but it sounds like you want to include the output of the external file and not access the code itself?
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

Post by tkarven »

yea is getting the output , so i should use file_get_contents ?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

yes :)
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

Post by tkarven »

hmmmh, file_get_contents doesnt seems to work, while on the other side include() works perfectly, the only additional tasks which i have to do is to define everything in full path on the origin file to be included.
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

Post by tkarven »

okie i using file_get_contents already, sorry for mis-words just now, it's because i didnt echo the string return. but still, i need to define everything in origin file in full path. Anyway, thanks for your reply, very much :D
tkarven
Forum Commoner
Posts: 41
Joined: Tue Aug 02, 2005 10:26 pm

Post by tkarven »

how about some page that need to gather input and process different output or even redirect to different page based on the input? and these different page might be different for each external host.

if we declare that input as a variable and get contents of the processing page, the value is not passed to the included page.

one of the solution i found is to pass the input together with a backlink, just wondering are there a better solution :)
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

I've never used it, so I could be wrong, but it sounds like you want cURL
Post Reply