note 68979 deleted from function.mysql-escape-string by nlopess
| From: | nlopess@php.net | Date: | Tue, 01 May 2007 13:41:44 +0000 |
| Subject: | note 68979 deleted from function.mysql-escape-string by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126050@lists.php.net to get a copy of this message | ||
Note Submitter: info at globalissa dot com
----
We need to distribute code compatible with as many servers as possible. We use this little function
on user submitted data:
// http://php.net/mysql_escape_string used for
wider isp host support - start
if(!function_exists('escape_smart')){
// Quote variable to make safe
function escape_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = mysql_escape_string($value);
}
return $value;
}
}