13-May-2012, 08:12 PM
I've found poor interest and tehnical dificulties when asking my hosting provider to disable Magic Quotes. There is a way with adding .php_ini to every subdirectory and then another solution if the 1st one is not working etc etc ... for Apache ... And I'm not sure about Nginx ...
Simple solution could be:
- to add pypass piece of kode to top level files of Admin Panel and Comments
- then add checkbox to Admin Panel, to switch that code On/Off
- and disable MagicQuotes bypass code by default.
Well, MagicQuotes are comming out of style, but hosting providers can hang on old PHP versions for years ...
lp, stariocek
--------------------------------------------------
I'm using this solution:
Simple solution could be:
- to add pypass piece of kode to top level files of Admin Panel and Comments
- then add checkbox to Admin Panel, to switch that code On/Off
- and disable MagicQuotes bypass code by default.
Well, MagicQuotes are comming out of style, but hosting providers can hang on old PHP versions for years ...
lp, stariocek
--------------------------------------------------
I'm using this solution:
PHP Code:
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
if (is_array($value)) {
$value = array_map('stripslashes_deep', $value);
} else if (is_object($value)) {
$vars = get_object_vars( $value );
foreach ($vars as $key=>$data) {
$value->{$key} = stripslashes_deep( $data );
}
} else {
$value = stripslashes($value);
}
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
?>