Re: Accessing function file on another domanin
From: Mike Harvey (spam_at_spam.com)
Date: 10/29/04
- Next message: Theo: "Re: How to get lost of the variable after a ? in a URL?"
- Previous message: TiM: "Re: How to get lost of the variable after a ? in a URL?"
- In reply to: Brommer: "Re: Accessing function file on another domanin"
- Next in thread: Oli Filth: "Re: Accessing function file on another domanin"
- Reply: Oli Filth: "Re: Accessing function file on another domanin"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 21:56:29 GMT
On Fri, 29 Oct 2004 15:46:28 +0200, Brommer <brommer@gmail.com> wrote:
>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.
>
But... according to the PHP manual, it is supposed to work. Perhaps
I'm reading it wrong?
>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.
>
According to the manual, $y cotains the result of function $_GET[f]()
and putting the return $y; in there is supposed to give the calling
file the contents of $y via the include() instead of a 1. See
http://us2.php.net/manual/en/function.include.php in the grey box just
above the User Contributed Notes.
>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.
>
Good point.... After thinking on this for a moment I'm thinking it
wouldn't be hard to restrict the $_GET[f]() line"f" to an allowable
list with an if() or switch() statement. That would allow only
intended functions to run and no other.
>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.
>
Bummer!
>Maybe if you told us what you are trying to accomplish someone would
>have some better sugestions for you.
>
Probably would help. Here's the plan: I have been coding with PHP &
MySQL for over 7 years now. I have accumulated quite a collection of
functions that I use repeatedly in all my programs. I was thinking
other people could use these too but I would like to charge for their
use. I know that's not in line with the open scource spirit, but a guy
has to make a living some how. My server would be acting as an ASP.
Just like Janwillem Borleffs said earlier in this thread:
"Another way is when the remote file accepts a parameter, parses
it and returns the parsed result. This is the principle of an API,
which is an interface to the actual program."
Does this help?
Mike H.
- Next message: Theo: "Re: How to get lost of the variable after a ? in a URL?"
- Previous message: TiM: "Re: How to get lost of the variable after a ? in a URL?"
- In reply to: Brommer: "Re: Accessing function file on another domanin"
- Next in thread: Oli Filth: "Re: Accessing function file on another domanin"
- Reply: Oli Filth: "Re: Accessing function file on another domanin"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|