All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
PHP技巧:过滤在线编辑器产生的不安全html代码_[PHP教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/17 7:36:50 Browse times: 302 Comment times: 0

PHP技巧:过滤在线编辑器产生的不安全html代码_[PHP教程]


Head photo

Go homepage
Upload pictures
Write articles

PHP技巧:过滤在线编辑器产生的不安全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="






";
//str="url(javascript:x)";

/*不需要过滤的数组*/
htm_on=array(
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"");

htm_on_uper=array(
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"");

/*字符格式*/
str=strtolower(str);
str=preg_replace("/s+/", " ", str);//过滤回车
str=preg_replace("/ +/", " ", str);//过滤多个空格

/*过滤/替换几种形式的js*/
str=preg_replace("/<(script.*?)>(.*?)<(/script.*?)>/si","",str);//删除格式,
//str=preg_replace("/<(script.*?)>(.*?)<(/script.*?)>/si","&lt;\1&gt;\2&lt;\3&gt;",str);//替换为可以显示的,

str=preg_replace("/<(script.*?)>/si","",str);//删除

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.