asp通用安全字符串输入替换server.htmlencode
<%
' ============================================
' 通用安全字符串输入,彻底替换server.htmlencode
' ============================================
Function HTMLEncode(Str)
If Isnull(Str) Then
HTMLEncode = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"", 1, -1, 1)
Str = Replace(Str, """", """, 1, -1, 1)
Str = Replace(Str,"<","<", 1, -1, 1)
Str = Replace(Str,">",">", 1, -1, 1)
Str = Replace(Str, "script", "script", 1, -1, 0)
Str = Replace(Str, "SCRIPT", "SCRIPT", 1, -1, 0)
Str = Replace(Str, "Script", "Script", 1, -1, 0)
Str = Replace(Str, "script", "Script", 1, -1, 1)
Str = Replace(Str, "object", "object", 1, -1, 0)
Str = Replace(Str, "OBJECT", "OBJECT", 1, -1, 0)
Str = Replace(Str, "Object", "Object", 1, -1, 0)
Str = Replace(Str, "object", "Object", 1, -1, 1)
Str = Replace(Str, "applet", "applet", 1, -1, 0)
Str = Replace(Str, "APPLET", "APPLET", 1, -1, 0)
Str = Replace(Str, "Applet", "Applet", 1, -1, 0)
Str = Replace(Str, "applet", "Applet", 1, -1, 1)
Str = Replace(Str, "[", "[")
Str = Replace(Str, "]", "]")
Str = Replace(Str, """", "", 1, -1, 1)
Str = Replace(Str, "=", "=", 1, -1, 1)
Str = Replace(Str, "'", "''", 1, -1, 1)
Str = Replace(Str, "select", "select", 1, -1, 1)
Str = Replace(Str, "execute", "execute", 1, -1, 1)
Str = Replace(Str, "exec", "exec", 1, -1, 1)
Str = Replace(Str, "join", "join", 1, -1, 1)
Str = Replace(Str, "union", "union", 1, -1, 1)
Str = Replace(Str, "where", "where", 1, -1, 1)
Str = Replace(Str, "insert", "insert", 1, -1, 1)
Str = Replace(Str, "delete", "delete", 1, -1, 1)
Str = Replace(Str, "update", "update", 1, -1, 1)
Str = Replace(Str, "like", "like", 1, -1, 1)
Str = Replace(Str, "drop", "drop", 1, -1, 1)
Str = Replace(Str, "create", "create", 1, -1, 1)
Str = Replace(Str, "rename", "rename", 1, -1, 1)
Str = Replace(Str, "count", "count", 1, -1, 1)
Str = Replace(Str, "chr", "chr", 1, -1, 1)
Str = Replace(Str, "mid", "mid", 1, -1, 1)
Str = Replace(Str, "truncate", "truncate", 1, -1, 1)
Str = Replace(Str, "nchar", "nchar", 1, -1, 1)
Str = Replace(Str, "char", "char", 1, -1, 1)
Str = Replace(Str, "alter", "alter", 1, -1, 1)
Str = Replace(Str, "cast", "cast", 1, -1, 1)
Str = Replace(Str, "exists", "exists", 1, -1, 1)
Str = Replace(Str,Chr(13),"<br>", 1, -1, 1)
HTMLEncode = Replace(Str,"'","''", 1, -1, 1)
End Function
%>
把上面代码保存为新的文件,包括到需要转换的页面,调用方式:HTMLEncode("字符串")
分类
最新日志
- python2.7.5升级到python3.5.1
- Excel判断一个单元格内内容是否在另一列中存在(出现过)
- excel文件没多少内容文件却很大怎么办?如何快速删除excel表中隐藏对象?
- mysql按指定顺序排序
- linux centos防止暴力破解,封掉多次失败的IP地址
- windows如何像linux使用ln一样创建目录链接
- 如何让linux支持rar压缩文件格式压缩和解压
- 如何创建一个自签名的SSL证书【转】
- Excel求某列值等于指定值对应另一列值的平均值
- centos 搭建git php自动部署。
- wget递归下载ftp内容,用户或密码中含有@。
- Linux/Centos源码安装配置Nginx+PHP+MySQL
- mysql视图学习记录
- screen命令让linux关闭ssh后进程继续运行。
- MySQL一次查询所有分类前N条记录
随机日志
- windows下面Oracle VM VirtualBox调整虚拟硬盘大小
- linux如何修改mysql数据库数据存放位置
- 记超大网站迁移数据文件
- centos 6最小化安装,无法上网安装其他软件解决办法
- wdcp安装中文分词scws
- wdcp安装apache2安装mod_proxy代理模块
- mysql limit 优化分页查询
- smarty使用小总结
- 随便终结一下,老是容易忘记,记录下来以便下次不用去百度
- linux使用常用命令记录
- linux netstat命令使用收集,查看80端口连接数
- linux创建目录连接
- 用mod_speling模块让linux下的apache不区分大小写
- centos 修改系统时间无效
- php利用curl登录页面并post提交数据上传文件
存档
- 2018年11月(1)
- 2017年12月(1)
- 2017年7月(1)
- 2017年5月(5)
- 2017年4月(1)
- 2016年10月(1)
- 2016年6月(1)
- 2016年5月(1)
- 2016年4月(3)
- 2015年12月(1)
- 2015年11月(1)
- 2015年5月(1)
- 2015年3月(1)
- 2015年2月(1)
- 2014年9月(2)
- 2014年7月(2)
- 2014年5月(1)
- 2014年4月(3)
- 2014年3月(3)
- 2014年1月(2)
- 2013年12月(1)
- 2013年11月(4)
- 2013年10月(2)
- 2013年9月(1)
- 2013年8月(2)
- 2013年6月(3)
- 2013年5月(1)
- 2013年4月(3)
- 2013年2月(3)
- 2012年12月(3)
- 2012年11月(5)
- 2012年10月(1)
- 2012年8月(2)
- 2012年7月(2)
- 2012年5月(3)
- 2012年4月(1)
- 2012年2月(2)
- 2011年11月(2)
- 2011年9月(1)
- 2011年8月(2)
- 2011年7月(2)
- 2011年5月(1)
- 2011年3月(3)
- 2011年2月(2)
- 2010年12月(1)
- 2010年11月(2)
- 2010年10月(3)
- 2010年9月(9)
- 2010年8月(8)
- 2010年7月(13)
- 2010年6月(18)
- 2010年5月(24)
- 2010年4月(10)
- 2010年3月(14)
- 2010年2月(6)
- 2010年1月(7)
- 2009年11月(2)
- 2009年10月(3)
- 2009年9月(3)
- 2009年8月(8)
- 2009年7月(15)
- 2009年6月(14)
- 2009年4月(2)
- 2008年12月(1)
- 2008年6月(1)
- 2008年5月(10)
- 2008年4月(9)
- 2008年3月(5)
- 2008年2月(2)
- 2008年1月(5)
- 2007年12月(4)
- 2006年9月(6)
- 2006年7月(1)
发表评论: