note 20105 deleted from ref.variables by nlopess
| From: | nlopess@php.net | Date: | Mon, 28 Jun 2004 14:27:09 +0000 |
| Subject: | note 20105 deleted from ref.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72012@lists.php.net to get a copy of this message | ||
Note Submitter: dekiland@rilasoft.com
----
Excellent and useful code Maxim Maletsky, but there is a small bug fix for it...
<?php
/// by Maxim Maletsky <maxim@maxim.cx>
$evil_vars = Array('GET', 'POST', 'COOKIE', 'SERVER',
'ENV', 'REQUEST',
'SESSION');
$php_version = preg_replace("/[^\d]/", '', phpversion());
for($i=0; $i<sizeof($evil_vars); $i++) {
if(is_array(${"HTTP_{$evil_vars[$i]}_VARS"})) {
foreach(${"HTTP_{$evil_vars[$i]}_VARS"} as $var=>$val)
{
if($php_version<410) {
$GLOBALS["_{$evil_vars[$i]}"][$var] = $val;
}
unset($$var); //changed from unset($$key); by dekiland
}
}
unset(${"HTTP_{$evil_vars[$i]}_VARS"});
}
Double cheers,
dekiland