CopyCode The Code is as follows: // $ rptype = 0 indicates that only the HTML Tag is replaced.
// $ Rptype = 1 indicates replacing the HTML Tag and removing consecutive white spaces
// $ Rptype = 2 indicates replacing the HTML Tag and removing all white spaces
// $ Rptype =-1 indicates that only the HTML dangerous tag is replaced.
Function htmlreplace ($ STR, $ rptype = 0)
{
$ STR = stripslashes ($ Str );
If ($ rptype = 0)
{
$ STR = htmlspecialchars ($ Str );
}
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 ("<[/] {0, 1} (link | meta | IFR | FRA) [^>] *>", '', $ Str );
}
Return addslashes ($ Str );
}