Que opinais de esta funcion para evitar este problema? me la ha pasado un amigo y quiero saber que opinais vosotros :)
Código PHP:
function antiinjection($str)
{
$banwords = array ("'", ",", ";", "--", " or ", ")", "(", " OR ", " and ", " AND ","/n","/r");
if ( eregi ( "[a-zA-Z0-9]+", $str ) )
{
$str = str_replace ( $banwords, '', ( $str ) );
} else {
$str = NULL;
}
$str = trim($str);
$str = strip_tags($str);
$str = stripslashes($str);
$str = addslashes($str);
$str = htmlspecialchars($str);
return $str;
}
Saludos.