function antiInjection($str)
{
# Remove palavras suspeitas de injection.
$str = preg_replace(sql_regcase("/(\n|\r|%0a|%0d|Content-Type:|bcc:|to:|cc:|Autoreply:|from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"), "", $str);
$str = trim($str); # Remove espaços vazios.
$str = strip_tags($str); # Remove tags HTML e PHP.
$str = addslashes($str); # Adiciona barras invertidas à uma string.
return $str;
}
function validaParametro($vetor)
{
if (is_array($vetor))
{
foreach ($vetor as $chave => $valor)
{
if (is_array($valor))
{
$vetor[$chave] = validaParametro($valor);
} else $vetor[$chave] = antiInjection($valor);
}
} else $vetor[$chave] = validaParametro($valor);
return $vetor;
}
$_POST = validaParametro($_POST);
$_GET = validaParametro($_GET);
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.