For people having trouble with magic quotes
Posted by: pureform
Posted on: 2005-10-05 15:34:00
If you have PHP running as CGI, you cannot turn magic quotes off ... not through .htaccess, and neither through ini_set() [at least it didn't work for me]. So I whipped up this script which filters everything for you:
# This filters all incoming data
foreach($_REQUEST as $key => $value) {
if (is_array($_REQUEST[$key])) {
$_REQUEST[$key] = array_map("stripslashes",$_REQUEST[$key]);
} else {
$_REQUEST[$key] = stripslashes($_REQUEST[$key]);
}
$$key = $_REQUEST[$key];
}
It's safe for array inputs as well as string inputs.