note 102000 added to function.mysql-real-escape-string
| From: | guzzano at archlinux dot com dot ve | Date: | Sat, 22 Jan 2011 04:32:38 +0000 |
| Subject: | note 102000 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175997@lists.php.net to get a copy of this message | ||
<?
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
----
Server IP: 69.147.83.197
Probable Submitter: 190.73.91.254
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/102000
Del: integrated -- https://master.php.net/note/delete/102000/integrated
Del: useless -- https://master.php.net/note/delete/102000/useless
Del: bad code -- https://master.php.net/note/delete/102000/bad+code
Del: spam -- https://master.php.net/note/delete/102000/spam
Del: non-english -- https://master.php.net/note/delete/102000/non-english
Del: in docs -- https://master.php.net/note/delete/102000/in+docs
Del: other reasons-- https://master.php.net/note/delete/102000
Reject -- https://master.php.net/note/reject/102000
Search -- https://master.php.net/manage/user-notes.php