note 55596 deleted from security.globals by philip
| From: | philip@php.net | Date: | Mon, 08 Aug 2005 18:43:39 +0000 |
| Subject: | note 55596 deleted from security.globals by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93267@lists.php.net to get a copy of this message | ||
Note Submitter: pavic at ieee dot org
Reason: bad code
----
Instead of register globals
If Your ini_set('register_globals',1) does not work, and
You don't want to rewrite all your code, include this at the top of your page:
$req=array_values($_REQUEST);
for($i=0;$i<=count($_REQUEST);$i++) {
$tmp="$".KeyName($_REQUEST,$i)."=\"".$req[$i]."\";";
eval($tmp);
}
function KeyName($myArray,$pos) {
if ( ($pos < 0) || ( $pos >= count($myArray) ) ) return "NULL";
reset($myArray);
for($i = 0;$i < $pos; $i++) next($myArray);
return key($myArray);
}
This will make all HTTP request variables local (post and get), that were available for your script
before.