Forum Moderators: coopster

Message Too Old, No Replies

Include variable and absolute link

variable not set with absolute inclusion

         

webstyler

4:24 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



Hi to all ;)

/////////////// THIS OK ///////////////
file index.php
<?
$myvar = test;
include ("example.php");
?>

file example.php
<? echo "You var is $myvar";?>

/////////////// THIS DON'T WORK ///////////////
file index.php
<?
$myvar = test;
include ("http://www.mysite.com/example.php");
?>

file example.php
<? echo "You var is $myvar";?>

------------------------

In the second example var is null
?
thks

mcibor

8:28 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, if you include a file from remote server it is processed there, not here. Otherwise it would be a huge security fault. Imagine the you include google server and all the data is passed directly to the hacker - unwise, isn't it?

What you can do is you can open the remote file: fopen and then execute it, but that's still unwise. I don't know a clean method to do that except POSTing the data and retrieving it.

Sorry I could not help
Michal Cibor

webstyler

10:27 pm on Jun 13, 2005 (gmt 0)

10+ Year Member



thks :)

I have use this solution ;)

file index.php
<?
include ("http://www.mysite.com/example.php?myvar=test");
?>

file example.php
<? echo "You var is $myvar";?>