(转)过滤在线编辑器产生的不安全html代码
    过滤在线编辑器产生的不安全html代码
 <?php   
  /**   
    *   过滤在线编辑器产生的不安全html代码.   
    *   
    *   PHP   versions   4   and   5   
    *   
    *   @copyright         版权所无,任意传播.   
    *   @link                   http://www.52sunny.net   
    *   @name                   html过滤     
    *   @version             v   0.0.10   
    *   @author               Lucklrj   (sunny_lrj@yeah.net,qq:7691272)   
    *   @lastmodified   2006-06-09   10:42   (Tue,   2006-06-09)     
    *   @notice               此版本只过滤js,框架,表单。   
                                    作者能力有限,使用本程序若产生任何安全问题,与本人无关。   
    欢迎来信与我交流。   
    */   
  $str="<tr><td   bgcolor=''#FFFFFF''>   
  <div   style=''url(123.offsetWidth)>";   
  //$str="url(javascript:x)";       
  /*不需要过滤的数组*/   
  $htm_on=array(   
  "<acronym","acronym>",   
  "<baseFont","baseFont>",   
  "<button","button>",   
  "<caption","caption>",   
  "<clientInformation","clientInformation>",   
  "<font","font>",   
  "<implementation","implementation>",   
  "<button","button>",   
  "<location","location>",   
  "<option","option>",   
  "<selection","selection>",   
  "<strong","strong>");       
  $htm_on_uper=array(   
  "<ACRONYM","span>ACRONYM>",   
  "<BASEFONT","BASEFONT>",   
  "<BUTTON","BUTTON>",   
  "<CAPTION","CAPTION>",   
  "<CLIENTINFORMATION","CLIENTINFORMATION>",   
  "<FONT","FONT>",   
  "<IMPLEMENTATION","IMPLEMENTATION>",   
  "<BUTTON","BUTTON>",   
  "<LOCATION","LOCATION>",   
  "<OPTION","OPTION>",   
  "<SELECTION","SELECTION>",   
  "<STRONG","STRONG>");     
  /*字符格式*/   
  $str=strtolower($str);   
  $str=preg_replace("/s+/",   "   ",   $str);//过滤回车   
  $str=preg_replace("/   +/"an style="COLOR: #000000">,   "   ",   $str);//过滤多个空格   
&nbs