我认为这对我来说是一个很好的解决方案。
你怎么看待这件事?
function clearPasswrod($value){
$value = trim($value); //remove empty spaces
$value = strip_tags(); //remove html tags
$value = htmlentities($value, ENT_QUOTES,'UTF-8'); //for major security transform some other chars into html corrispective...
return $value;
}
function clearText($value){
$value = trim($value); //remove empty spaces
$value = strip_tags(); //remove html tags
$value = filter_var($value, FILTER_SANITIZE_MAGIC_QUOTES); //addslashes();
$value = filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); //remove /t/n/g/s
$value = filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); //remove é à ò ì ` ecc...
$value = htmlentities($value, ENT_QUOTES,'UTF-8'); //for major security transform some other chars into html corrispective...
return $value;
}
function clearEmail($value){
$value = trim($value); //remove empty spaces
$value = strip_tags(); //remove html tags
$value = filter_var($value, FILTER_SANITIZE_EMAIL); //e-mail filter;
if($value = filter_var($value, FILTER_VALIDATE_EMAIL))
{
$value = htmlentities($value, ENT_QUOTES,'UTF-8');//for major security transform some other chars into html corrispective...
}else{$value = "BAD";}
return $value;
}