در ضمن تابع زیر رو زمانی میشه بکار برد که به ورودی اجازه کدهای html رو میدیم ولی اجازه ورود تگ های حساس رو منع می کنیم:


کد:
function filter_html_dangerous_tags($what){ 
     $what = str_replace( "<script>"        , "&lt;script&gt;"      , $what ); 
     $what = str_replace( "</script>"       , "&lt;/script&gt;"     , $what ); 
     $what = str_replace( "<object>"        , "&lt;object&gt;"      , $what ); 
     $what = str_replace( "</object>"       , "&lt;/object&gt;"     , $what );
     $what = str_replace( "<iframe>"        , "&lt;iframe&gt;"      , $what ); 
     $what = str_replace( "</iframe>"       , "&lt;/iframe&gt;"     , $what ); 
     $what = str_replace( "<frameset>"      , "&lt;frameset&gt;"    , $what ); 
     $what = str_replace( "<frameset>"      , "&lt;frameset&gt;"    , $what );
     $what = str_replace( "<frame>"         , "&lt;frame&gt;"       , $what ); 
     $what = str_replace( "</frame>"        , "&lt;/frame&gt;"      , $what ); 
     $what = str_replace( "<link>"          , "&lt;link&gt;"        , $what ); 
     $what = str_replace( "</link>"         , "&lt;/link&gt;"       , $what );
 return $what; 
}