note 43545 deleted from function.get-magic-quotes-gpc by nlopess
| From: | nlopess@php.net | Date: | Fri, 25 Jun 2004 09:30:32 +0000 |
| Subject: | note 43545 deleted from function.get-magic-quotes-gpc by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71655@lists.php.net to get a copy of this message | ||
Note Submitter: patrick@phpforhire.REMOVETHIS.com
----
I recently encountered a situation where the keys of arrays in the $_POST vars were
set_magic_quotes_runtime(0);
function magicQuotesRemove(&$array) {
if(!get_magic_quotes_gpc())
return;
/* Prepare a new array */
$copy = array();
foreach($array as $key => $elem) {
$copy[stripslashes($key)] = $elem;
if(is_array($elem))
magicQuotesRemove($elem);
else
$elem = stripslashes($elem);
$copy[stripslashes($key)] = $elem;
}
$array = $copy;
}
magicQuotesRemove($_GET);
magicQuotesRemove($_POST);
magicQuotesRemove($_COOKIE);
magicQuotesRemove($_REQUEST);