数组操作系列之防止js注入
来源:互联网 发布:饥荒数据修改大全 编辑:程序博客网 时间:2024/05/19 10:41
<?php$content = '';$search = array ("'<script[^>]*?>.*?</script>'si", // 去掉 javascript "'<style[^>]*?>.*?</style>'si", // 去掉 css "'<[/!]*?[^<>]*?>'si", // 去掉 HTML 标记 "'<!--[/!]*?[^<>]*?>'si", // 去掉 注释标记 "'([rn])[s]+'", // 去掉空白字符 "'&(quot#34);'i", // 替换 HTML 实体 "'&(amp#38);'i", "'&(lt#60);'i", "'&(gt#62);'i", "'&(nbsp#160);'i", "'&(iexcl#161);'i", "'&(cent#162);'i", "'&(pound#163);'i", "'&(copy#169);'i", "'&#(d+);'e"); // 作为 PHP 代码运行 $replace = array ("", "", "", "", "\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), );$content = preg_replace($search, $replace,$content);$arr1 = array(" ");$arr2 = array("");$content = str_replace($arr1,$arr2,$content);$content = preg_replace('#\s+#', ' ', trim($content));$content = substr($content,0,300);$re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";preg_match_all($re['utf-8'], $content, $match);
阅读全文
0 0
- 数组操作系列之防止js注入
- 防止JS注入
- 防止JS脚本注入
- 防止js注入
- 防止js注入
- 防止JS注入
- JAVA防止JS html 注入
- 基础知识之防止SQL注入
- Java 之防止 SQL 注入
- 数组操作系列之循环去重
- js asp c# 防止sql注入
- js asp c# 防止sql注入
- php,防止js注入的正则表达式
- PYTHON操作MYSQL时防止SQL注入
- PYTHON操作MYSQL时防止SQL注入
- java知识系列之操作js文件
- web.js.数组操作之sort()
- js 面试题之---数组、字符串操作
- 机器学习实现双十一购物清单的自动商品标签归类
- Math对象总结(向上取整、向下取整、四舍五入、取随机数,取最大值、取最小值....)
- TCP和UDP的区别
- ES6-正则的扩展-后行断言
- ArcGIS Engine调用自定义GP服务(一)
- 数组操作系列之防止js注入
- Oracle转Mysql需要注意的地方
- vs2010设置CListBox字体颜色
- swift 3.0 UITableView 懒加载写法(lazy)
- CentOS Linux配置网易(163)的yum源
- 付款按钮设计的糟糕现状
- 查询值为null
- [App] Nginx 基本安装
- 2017-11-1