note 31088 modified in function.set-magic-quotes-runtime by tix
| From: | tix@php.net | Date: | Wed, 09 Apr 2003 11:59:47 +0000 |
| Subject: | note 31088 modified in function.set-magic-quotes-runtime by tix | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46409@lists.php.net to get a copy of this message | ||
This is my code fix the PHP's Quote,it's worked for me..
function paddslashes(&$a) {
if (is_array($a)) {
foreach ($a as $fname => $fval) {
if (is_array($fval))
paddslashes($a[$fname],$tmp[$fname]);
else
$a[$fname] = addslashes($fval);
}
}
}
if (phpversion() < '4.1.0') {
isset($HTTP_SESSION_VARS) ? $_SESSION = $HTTP_SESSION_VARS : '';
isset($HTTP_SERVER_VARS) ? $_SERVER = $HTTP_SERVER_VARS : '';
isset($HTTP_ENV_VARS) ? $_ENV = $HTTP_ENV_VARS : '';
isset($HTTP_FILES_VARS) ? $_FILES = $HTTP_FILES_VARS : '';
if (get_magic_quotes_gpc() == 1) {
isset($HTTP_GET_VARS) ? $_GET = $HTTP_GET_VARS : '';
isset($HTTP_POST_VARS) ? $_POST = $HTTP_POST_VARS : '';
isset($HTTP_COOKIE_VARS) ? $_COOKIE = $HTTP_COOKIE_VARS : '';
} else {
isset($HTTP_GET_VARS) ? paddslashes($HTTP_GET_VARS) : '';
isset($HTTP_POST_VARS) ? paddslashes($HTTP_POST_VARS) : '';
isset($HTTP_COOKIE_VARS) ? paddslashes($HTTP_COOKIE_VARS) : '';
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_COOKIE = $HTTP_COOKIE_VARS;
}
} else {
if (get_magic_quotes_gpc() != 1) {
isset($_GET) ? paddslashes($_GET) : '';
isset($_POST) ? paddslashes($_POST) : '';
isset($_COOKIE) ? paddslashes($_COOKIE) : '';
}
}
--was--
Sorry,The code ablove is error.This is the Fixed Version:
function paddslashes(&$a) {
if (is_array($a)) {
foreach ($a as $fname => $fval) {
if (is_array($fval))
paddslashes($a[$fname],$tmp[$fname]);
else
$a[$fname] = addslashes($fval);
}
}
}
if (phpversion() < '4.1.0') {
isset($HTTP_SESSION_VARS) ? $_SESSION = $HTTP_SESSION_VARS : '';
isset($HTTP_SERVER_VARS) ? $_SERVER = $HTTP_SERVER_VARS : '';
isset($HTTP_ENV_VARS) ? $_ENV = $HTTP_ENV_VARS : '';
isset($HTTP_FILES_VARS) ? $_FILES = $HTTP_FILES_VARS : '';
if (get_magic_quotes_gpc() == 1) {
isset($HTTP_GET_VARS) ? $_GET = $HTTP_GET_VARS : '';
isset($HTTP_POST_VARS) ? $_POST = $HTTP_POST_VARS : '';
isset($HTTP_COOKIE_VARS) ? $_COOKIE = $HTTP_COOKIE_VARS : '';
} else {
isset($HTTP_GET_VARS) ? paddslashes($HTTP_GET_VARS) : '';
isset($HTTP_POST_VARS) ? paddslashes($HTTP_POST_VARS) : '';
isset($HTTP_COOKIE_VARS) ? paddslashes($HTTP_COOKIE_VARS) : '';
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_COOKIE = $HTTP_COOKIE_VARS;
}
} else {
if (get_magic_quotes_gpc() != 1) {
isset($_GET) ? paddslashes($_GET) : '';
isset($_POST) ? paddslashes($_POST) : '';
isset($_COOKIE) ? paddslashes($_COOKIE) : '';
}
}
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php