note 84051 added to security.magicquotes
| From: | travismowens at gmail dot com | Date: | Wed, 25 Jun 2008 17:25:16 +0000 |
| Subject: | note 84051 added to security.magicquotes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140813@lists.php.net to get a copy of this message | ||
With just a couple minor updates to Thomas' function, it can support both arrays and variables
like so:
function RemoveMagicQuotes ($postArray, $trim = false)
{
if (get_magic_quotes_gpc() == 1)
{
if ( is_array($postArray) )
{
$newArray = array();
foreach ($postArray as $key => $val)
{
if (is_array($val))
{
$newArray[$key] = removeMagicQuotes ($val, $trim);
}
else
{
if ($trim == true)
{
$val = trim($val);
}
$newArray[$key] = stripslashes($val);
}
}
return $newArray;
}
else
{
return stripcslashes($postArray);
}
}
else
{
return $postArray;
}
}
----
Server IP: 64.71.164.2
Probable Submitter: 24.39.174.1
----
Manual Page -- http://www.php.net/manual/en/security.magicquotes.php
Edit -- https://master.php.net/note/edit/84051
Del: integrated -- https://master.php.net/note/delete/84051/integrated
Del: useless -- https://master.php.net/note/delete/84051/useless
Del: bad code -- https://master.php.net/note/delete/84051/bad+code
Del: spam -- https://master.php.net/note/delete/84051/spam
Del: non-english -- https://master.php.net/note/delete/84051/non-english
Del: in docs -- https://master.php.net/note/delete/84051/in+docs
Del: other reasons-- https://master.php.net/note/delete/84051
Reject -- https://master.php.net/note/reject/84051
Search -- https://master.php.net/manage/user-notes.php