antixss代码

        
  1. ? function antixss ( $content ) {
  2.     preg_match ( "/(.source*)\[a\](.source*)\[\/a\](.source*)/" , $content , $url );
  3.     $key = array (
  4.         "(" ,
  5.         ")" ,
  6.         "&" ,
  7.         "\\" ,
  8.         "<" ,
  9.         ">" ,
  10.         "'" ,
  11.         "%28" ,
  12.         "%29" ,
  13.         " on" ,
  14.         "data" ,
  15.         "src" ,
  16.         "eval" ,
  17.         "unescape" ,
  18.         "innerHTML" ,
  19.         "document" ,
  20.         "appendChild" ,
  21.         "createElement" ,
  22.         "write" ,
  23.         "String" ,
  24.         "setTimeout" ,
  25.         "cookie"
  26.     );
  27.         $re = $url [ 2 ]; if ( count ( $url )== 0 ){ return htmlspecialchars ( $content );  
  28.         }
  29.         else {  
  30.         for ( $i = 0 ; $i <= count ( $key ); $i ++){ $re = str_replace ( $key [ $i ], '_' , $re ); } return htmlspecialchars ( $url [ 1 ], ENT_QUOTES ). source '<a href="' . source$re . source '">' . source$re . source '</a>' . sourcehtmlspecialchars ( $url [ 3 ], ENT_QUOTES );  
  31.         }  
  32. }