note 69357 added to function.mysql-real-escape-string
| From: | Ultimater at gmail dot com | Date: | Fri, 01 Sep 2006 22:37:51 +0000 |
| Subject: | note 69357 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116601@lists.php.net to get a copy of this message | ||
Ahh... php at rebel dot com dot au, you are right. There is a big different between
magic_quotes_runtime and magic_quotes_gpc. What I'm looking for is really a
set_magic_quotes_gpc function however there is none. However we can alter the super global
variables and simulate the function very closely.
Behold set_magic_quotes_gpc:
<?php
function set_magic_quotes_gpc($arg1){
global $MAGIC_QUOTES_GPC;
if(!$MAGIC_QUOTES_GPC)
$MAGIC_QUOTES_GPC=get_magic_quotes_gpc()?"ON":"OFF";
global $_GET,$_POST,$_COOKIE,$_REQUEST;
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_COOKIE_VARS;
if(!$arg1 && $MAGIC_QUOTES_GPC=="ON"){
$_GET=array_map("stripslashes",$_GET);
$_POST=array_map("stripslashes",$_POST);
$_COOKIE=array_map("stripslashes",$_COOKIE);
$_REQUEST=array_map("stripslashes",$_REQUEST);
$HTTP_POST_VARS=array_map("stripslashes",$HTTP_POST_VARS);
$HTTP_GET_VARS=array_map("stripslashes",$HTTP_GET_VARS);
$HTTP_COOKIE_VARS=array_map("stripslashes",$HTTP_COOKIE_VARS);
$MAGIC_QUOTES_GPC="OFF";
}
elseif($arg1 && $MAGIC_QUOTES_GPC=="OFF"){
$_GET=array_map("addslashes",$_GET);
$_POST=array_map("addslashes",$_POST);
$_COOKIE=array_map("addslashes",$_COOKIE);
$_REQUEST=array_map("addslashes",$_REQUEST);
$HTTP_POST_VARS=array_map("addslashes",$HTTP_POST_VARS);
$HTTP_GET_VARS=array_map("addslashes",$HTTP_GET_VARS);
$HTTP_COOKIE_VARS=array_map("addslashes",$HTTP_COOKIE_VARS);
$MAGIC_QUOTES_GPC="ON";
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 24.130.171.156
----
X-Spam-Status: No, hits=3.9 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
UPPERCASE_50_75 autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/69357
Del: integrated -- https://master.php.net/note/delete/69357/integrated
Del: useless -- https://master.php.net/note/delete/69357/useless
Del: bad code -- https://master.php.net/note/delete/69357/bad+code
Del: spam -- https://master.php.net/note/delete/69357/spam
Del: non-english -- https://master.php.net/note/delete/69357/non-english
Del: in docs -- https://master.php.net/note/delete/69357/in+docs
Del: other reasons-- https://master.php.net/note/delete/69357
Reject -- https://master.php.net/note/reject/69357
Search -- https://master.php.net/manage/user-notes.php