Beispiel #1
0
function addSlashesArray($array)
{
    foreach ($array as $key => $val) {
        if (is_array($val)) {
            $array[$key] = addSlashesArray($val);
        } else {
            $array[$key] = addslashes($val);
        }
    }
    return $array;
}
Beispiel #2
0
/**
 * add slashes to every value of array
 */
function addSlashesArray(&$a)
{
    for (reset($a); list($k, $v) = each($a);) {
        if (is_array($v)) {
            addSlashesArray($v);
        } else {
            $a[$k] = addslashes($v);
        }
    }
}
function addSlashesArray($arr)
{
    foreach ($arr as $k => $v) {
        if (is_array($v)) {
            $arr[$k] = addSlashesArray($v);
        } else {
            $arr[$k] = addslashes($v);
        }
    }
    return $arr;
}
Beispiel #4
0
    $version = PHP_VERSION;
    define('PHP_VERSION_ID', $version[0] * 10000 + $version[2] * 100 + $version[4]);
}
if (PHP_VERSION_ID < 50300) {
    @set_magic_quotes_runtime(false);
    //disable magic quotes
    ini_set('magic_quotes_gpc', 'On');
    ini_set('magic_quotes_runtime', 'Off');
    ini_set('register_long_arrays', 'On');
    //ini_set('register_globals', 'On');
}
// --- get 'post', 'get' and 'cookie' variables
foreach ($_REQUEST as $postkey => $postvalue) {
    if ($postkey[0] != '_' and !preg_match('/[A-Z]/', $postkey[0])) {
        if (!function_exists('get_magic_quotes_gpc') or !get_magic_quotes_gpc()) {
            $postvalue = addSlashesArray($postvalue);
            $_REQUEST[$postkey] = $postvalue;
            if (isset($_GET[$postkey])) {
                $_GET[$postkey] = $postvalue;
            } elseif (isset($_POST[$postkey])) {
                $_POST[$postkey] = $postvalue;
            } elseif (isset($_COOKIE[$postkey])) {
                $_COOKIE[$postkey] = $postvalue;
            }
        }
        ${$postkey} = $postvalue;
    }
}
/**
 * Escape strings with backslashes before characters that need to be escaped.
 * These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).