note 102000 deleted from function.mysql-real-escape-string by danbrown
| From: | danbrown@php.net | Date: | Sat, 22 Jan 2011 04:37:33 +0000 |
| Subject: | note 102000 deleted from function.mysql-real-escape-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175999@lists.php.net to get a copy of this message | ||
Note Submitter: guzzano at archlinux dot com dot ve
----
<?
function Anti_SQL_Injection($string)
{
$ip = $_SERVER['REMOTE_ADDR'];
$file = fopen("log/injection.log", "a+");
$injection = array(";","'","%",'"');
for ($i = 0 ; $i < strlen($string) ; $i++)
{
for ($j = 0 ; $j < count($injection) ; $j++)
{
if ($string[$i] == $injection[$j])
{
$new_string = str_replace($injection[$i], "", $string);
fwrite($file, "Detected SQL Injection by $ip \n");
}
}
}
if ($string != $new_string)
{
return $new_string;
}
else
{
return $string;
}
}
?>
I created this function and I have no problems yet