note 50776 added to function.include

From: Date: Wed, 09 Mar 2005 17:06:45 +0000
Subject: note 50776 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-86160@lists.php.net to get a copy of this message
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"); ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50776 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50776&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50776&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50776&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50776&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50776&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50776&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86160) next »