Htmlreplace is to replace the contents of all HTML files or selected HTML files in a directory with the contents of the specified file, which is especially useful for the same contents of a page, such as a menu bar.
This substitution function allows for some security filtering of user input, preventing users from committing unsafe code.
$rptype = 0 means replacing HTML tags only//$rptype = 1 means replacing HTML tags while removing contiguous whitespace characters//$rptype = 2 means replacing HTML tags while removing all whitespace characters//$rptype =-1 means only Replace the HTML dangerous tag function htmlreplace ($STR, $rptype =0) {$str = Stripslashes ($STR), if ($rptype ==0) {$str = Htmlspecialchars ($st R); } else if ($rptype ==1) {$str = Htmlspecialchars ($str); $str = Str_replace ("", "', $str); $str = Ereg_replace ("[Rnt]{1,}", ", $str); } else if ($rptype ==2) {$str = Htmlspecialchars ($str); $str = Str_replace ("", "', $str); $str = Ereg_replace ("[Rnt]", "', $str); } else {$str = Ereg_replace ("[Rnt]{1,}", "', $str); $str = eregi_replace (' script ', ' script ', $str); $str = Eregi_replace (" & Lt [/] {0,1} (LINK|META|IFR|FRA) [^>]*> ",", $str); } return Addslashes ($STR); }