Disable magic quotes

Feature magic quotes has been removed as of PHP 5.4.0 and deprecated as of PHP 5.3.0. However, if for some reason you are using an older version, and you don’t want to use magic_quotes (especially when you editing content by the CKEditor), there are two ways to disable this feature.

1. Edit .htaccess file:

To file just add the following line.

php_flag magic_quotes_gpc Off

2. Disable during the performance:

if (get_magic_quotes_gpc()) {
    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    while (list($key, $val) = each($process)) {
        foreach ($val as $k => $v) {
            unset($process[$key][$k]);
            if (is_array($v)) {
                $process[$key][stripslashes($k)] = $v;
                $process[] = &$process[$key][stripslashes($k)];
            } else {
                $process[$key][stripslashes($k)] = stripslashes($v);
            }
        }
    }
    unset($process);
}