note 50776 deleted from function.include by nlopess
| From: | nlopess@php.net | Date: | Fri, 11 Mar 2005 19:45:13 +0000 |
| Subject: | note 50776 deleted from function.include by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86280@lists.php.net to get a copy of this message | ||
Note Submitter: mdk at samsalisbury dot co dot uk
----
Here's a useful script for letting Flash access scripts residing above the DocumentRoot of your
website. I just came up with this in a hurry, so I know it can be improved upon...
This file is called 'script_link.php' as it contains a ref. to itself...
<?PHP
/* This allows things like Flash content to access
php scripts above the DocumentRoot...
Even with 'GET' arguments passed ;-)
Note: Assumes the script filename ends in '.php'
*/
$args = array();
$i=0;
if(isset($_GET)) {
foreach($_GET as $var => $val) {
if($i++==0) {
$scriptname = $var;
} else {
$args[$var] = $val;
}
}
// RESET 'GET' ARRAY
$_GET = array();
// Recreate it for the benefit of the target script...
foreach($args as $var => $val) {
$_GET[$var] = $val;
}
require_once "/path/to/scripts/$scriptname.php";
} else {
echo "Usage: script_link.php?scriptname&arg1=value1&arg2=value2...";
}
?>
To use in flash:
getURL("script_link.php?scriptname&arg1=value1&arg2=value2...etc");