#HTML posted by users, filter dangerous codes
function uh($str)
{
$farr = array(
"/\s+/", //Filter excess whitespace
" /<(\/?)(scrīpt|i?frame|style|html|body|title|link|meta|\?|\%)([^>]*?)>/isU", // Filter
);
$tarr = array(
" ",
"<\\1\\2\\3>", //If you want to directly clear unsafe tags, you can leave it blank here
"\\1\\2",
);
$str = preg_replace( $farr,$tarr,$str);
return $str;
}