May
20
2004

Magic Quotes! Yay!

PHP: get_magic_quotes_gpc - Manual

Having one of those GPC nightmares! Anyway found this happy snippet that un-does the GPC “magic”.

[code]
function magicQuotesRemove(&$array) {
if(!get_magic_quotes_gpc())
return;
foreach($array as $key => $elem) {
if(is_array($elem))
magicQuotesRemove($elem);
else
$array[$key] = stripslashes($elem);
}
}

magicQuotesRemove($_GET);
magicQuotesRemove($_POST);
magicQuotesRemove($_COOKIE);
[/code]

Written by Aaron in: Software |

1 Comment »

RSS feed for comments on this post.

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes