note 114373 deleted from function.sql-regcase by googleguy
| From: | googleguy@php.net | Date: | Thu, 13 Feb 2014 12:54:06 +0000 |
| Subject: | note 114373 deleted from function.sql-regcase by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198496@lists.php.net to get a copy of this message | ||
Note Submitter: jomadee at lliure dot com dot br
----
Alternative quando usada para anti-injection
// Anti injection
function jf_anti_injection($sql) {
if(is_array($sql)){
foreach($sql as $chave => $valor)
$sql[$chave] = jf_anti_injection($valor);
} else {
$sql = get_magic_quotes_gpc() ? stripslashes($sql) : $sql;
$sql = function_exists('mysql_real_escape_string') ?
mysql_real_escape_string($sql) : mysql_escape_string($sql);
$sql = trim($sql); # Remove espaços vazios.
$sql = addslashes($sql); # Adiciona barras invertidas à uma string.
}
return $sql;
}