note 57203 added to function.include
| From: | Sharter at customsiliconebracelets dot com | Date: | Tue, 27 Sep 2005 05:49:57 +0000 |
| Subject: | note 57203 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95850@lists.php.net to get a copy of this message | ||
I put together a scheme to include remote files securely and thought I'd share it.
Basically I have a function that contains file names of the remote files I use throught out the
site.
something like:
function remote_files()
{
global $functions, $log, $etc;
$functions = "97I34r5GHKJr5hkjBsjfg.sfd ojhG*(h";
$log = "p9uyjOLIHKYHOGhjk.,nOGihb";
$etc = "jhvb&GVJKe89y984ugfgajzdgf";
return(true);
}
The strings are actually hash values. When I create the pages on serverX that I know I'll need
on serverY I hash them and name them their hash.
When I include the file on ServerY I do so using it's variable:
include("https://www.serverX.com/includes/remote/{$log}.php");
and I capture it's content using ob_start & ob_get_contents or whatever. I hash the value
and compare it to it's file name. If there's no match, I "end;" and print a
little error.
I'm not working with hundreds of files so it's no too hard to deal with the hash values.
Also, the files are pretty well debugged and static at this point.
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57203
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57203&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57203&report=yes
Search -- http://master.php.net/manage/user-notes.php