Hi!
Long and winding post, but I'll try to answer ๐ :
So you are saying it wouldn't work? ($file=...)
Yes, I don't think php will give you any values, except the ones that are actually echoed into the remote file on parse.
The same for include('http://remote.com/remote.php');
But I've read a bit on php.net, and the answer the provide is rather vague:
If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using an URL (via HTTP or other supported wrapper - see Appendix I for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using an URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
It seems you have to call the values in the include() statement:
include('http://remote.com?var=2&var2=3');
But this will not let the remote script send any values back, but the result of your query ?var=2&var2=3 (And not even those, but their result)
It is, as far as i know, sent as straight html, because the remote server will treat the request as a standard http-request and send only parsed content back.
But hey - I'm no expert on this, just a thought ๐
Warning: SAFE MODE Restriction in effect. The script with your uid is not allowed to access a file owned by another uid in hack.php on line 6
Ah, they're running in safe mode. On some servers with many users, this will prevent other users at same server from viewving each others code. Just read about it in a php book ๐
Strange that it would treat your request that way, though - since it was from a remote server.
Your confidence is reassuring but tell me why then where the developers of the script so aggressively emphasizing that that sensitive file should be outside of a publicly accessible dir?
Probably because they tend to be as inc, which won't be treated as a standalone page, and where (some of) the php will be echoed "as is". This may be avoided by telling apache to treat inc's as php, but more than often it isn't done.
There's a huge difference between php-scripts and other files in this respect - the php-file is able to protect itself from viewers, while a txt-file would be viewable to all (if it is for php).
You can also protect any files from being viewed under your web-dir by placing deny-statements in httpd.conf:
<Location /includes/*.inc>
Order deny,allow
Deny from all
</Location>
I also think you may use this in .htaccess, but I'm not sure how.
knutm