I use this one.
~IcemanPHP Code:function antisql($sql)
{
$sql = htmlspecialchars($sql);
$sql = str_replace("'", '& #039;', $sql);
$sql = str_replace('"', '"e;', $sql);
return $sql;
}
Don't forget to include the sanitize_data function in whatever script is calling it!
i don't know why the user even should be allowed slash, dot or comma...
a-z A-Z 0-9 - and _ should be enough for most of us...
also if you do it on "exclude" list then be sure to get rid of lineswitches also :p although i'm pretty sure that's not something that you usually get from inputfield lol...