note 83503 added to function.mysql-real-escape-string
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 28 May 2008 23:10:36 +0000 |
| Subject: | note 83503 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139958@lists.php.net to get a copy of this message | ||
function mysql_prep($value){
$magic_quotes_active = get_magic_quotes_gpc();
$new_enough_php = function_exists("mysql_real_escape_string");
// i.e PHP >= v4.3.0
if($new_enough_php){
//undo any magic quote effects so mysql_real_escape_string can do the work
if($magic_quotes_active){
$value = stripslashes($value);
}
$value = mysql_real_escape_string($value);
}else{ // before PHP v4.3.0
// if magic quotes aren't already on this add slashes manually
if(!$magic_quotes_active){
$value = addslashes($value);
} //if magic quotes are avtive, then the slashes already exist
}
return $value;
}
----
Server IP: 66.207.199.35
Probable Submitter: 24.72.46.62
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/83503
Del: integrated -- https://master.php.net/note/delete/83503/integrated
Del: useless -- https://master.php.net/note/delete/83503/useless
Del: bad code -- https://master.php.net/note/delete/83503/bad+code
Del: spam -- https://master.php.net/note/delete/83503/spam
Del: non-english -- https://master.php.net/note/delete/83503/non-english
Del: in docs -- https://master.php.net/note/delete/83503/in+docs
Del: other reasons-- https://master.php.net/note/delete/83503
Reject -- https://master.php.net/note/reject/83503
Search -- https://master.php.net/manage/user-notes.php