Re: Accessing function file on another domanin
From: Brommer (brommer_at_gmail.com)
Date: 10/29/04
- Next message: Craig Keightley: "Re: convert time"
- Previous message: Harrie Verveer: "Re: convert time"
- In reply to: Mike Harvey: "Re: Accessing function file on another domanin"
- Next in thread: Mike Harvey: "Re: Accessing function file on another domanin"
- Reply: Mike Harvey: "Re: Accessing function file on another domanin"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 15:46:28 +0200
Mike Harvey wrote:
> If I use these:
> ===================
> File A:
> <?PHP
> $x=include'http://siteb.com/func/?f=IBIZ_line';
> echo "x=$x<BR />y=$y";
> ?>
>
> File B (on siteb.com):
> <?PHP
> include("IBIZ_func_general.inc");
> $y= $_GET[f]();
> return $y;
> ?>
> ====================
> I get:
> x=1
> y=
>
> If I change file B to:
>
> <?PHP
> include("IBIZ_func_general.inc");
> $y= $_GET[f]();
> echo $y;
> ?>
>
> I get the expected output from the echo() statement but $x still
> contains 1 and $y is empty.
First, like I said, you are assigning the result of the include to $x
...this is always 1 (succes) or 0 (failed) ..not the file you try to
include.
Second, the return statement here is meaningless since there is nothing
to return from. You are trying to include a file as if it was on your
local filesystem but it is not..file 'A' accesses file 'B' in exactly
the same way as you would with your webbrowser as others have pointed out.
Third, calling functions like that directly from the querystring
($_GET['f']() ) is extremely dangerous. Anybody with access to your
webserver (ie if it is on the Internet anyone with Internet access) can
execute any PHP function they want in your script.
In your second example script A calls script B, script B echoes the
value of $y and then exits. Script A just includes these results nothing
more, you cannot magically call functions between hosts like that.
Maybe if you told us what you are trying to accomplish someone would
have some better sugestions for you.
Cheers,
B
- Next message: Craig Keightley: "Re: convert time"
- Previous message: Harrie Verveer: "Re: convert time"
- In reply to: Mike Harvey: "Re: Accessing function file on another domanin"
- Next in thread: Mike Harvey: "Re: Accessing function file on another domanin"
- Reply: Mike Harvey: "Re: Accessing function file on another domanin"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|