Re: Accessing function file on another domanin

From: Brommer (brommer_at_gmail.com)
Date: 10/29/04


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



Relevant Pages

  • Re: Terminate a process.
    ... > Hi I work for a school and want to be able to stop certain kids (when they ... It looks like this script is designed to run from a remote computer. ... advice about stopping the WMI service on the target. ... If you really want to stop all internet access, ...
    (microsoft.public.windows.server.scripting)
  • PHP script to disable/enable internet access
    ... (iff network status = inactive) ... Your Internet Access is DISABLED ... "/sbin/network start" or whatever the script is and refresh the page ...
    (comp.lang.php)
  • delegating a script execution on workstations
    ... internet access via IE 6.0 disabled. ... will remotely relogin (all workstations approx. ... particular rights would be needed for the user to remotely execute a script ...
    (microsoft.public.windows.server.scripting)
  • Re: Detecting when the user moves away from two particular pages
    ... the session, am I right?). ... maybe instead you should pass form post or querystring get values back and ... When I have a script with multiple steps I usually key off each step in the ... program by modifying session information when creating and modifying users. ...
    (microsoft.public.dotnet.framework.aspnet)
  • httpd playlist download not always replacing string values in URL
    ... The script dynamically generates playlists for each user, depending on the querystring that is passed to the player and on the user's IP address and User ID. ... This leads me to believe that this is a server problem. ...
    (microsoft.public.windowsmedia.server)