手机
当前位置:查字典教程网 >编程开发 >ASP教程 >asp终极防范SQL注入漏洞
asp终极防范SQL注入漏洞
摘要:下面给出4个函数,足够你抵挡一切SQL注入漏洞!读懂代码,你就能融会贯通。注意要对所有的request对象进行过滤:包括request.co...

下面给出4个函数,足够你抵挡一切SQL注入漏洞!读懂代码,你就能融会贯通。

注意要对所有的request对象进行过滤:包括 request.cookie, request.ServerVariables 等等容易被忽视的对象:

复制代码 代码如下:

function killn(byval s1) '过滤数值型参数

if not isnumeric(s1) then

killn=0

else

if s1<0 or s1>2147483647 then

killn=0

else

killn=clng(s1)

end if

end if

end function

function killc(byval s1) 过滤货币型参数

if not isnumeric(s1) then

killc=0

else

killc=formatnumber(s1,2,-1,0,0)

end if

end function

function killw(byval s1) '过滤字符型参数

if len(s1)=0 then

killw=""

else

killw=trim(replace(s1,"'",""))

end if

end function

function killbad(byval s1) 过滤所有危险字符,包括跨站脚本

If len(s1) = 0 then

killbad=""

else

killbad = trim(replace(replace(replace(replace(replace(replace(replace(replace(s1,Chr(10), "<br>"), Chr(34), """), ">", ">"), "<", "<"), "&", "&"),chr(39),""),chr(13),""))

end if

end function

【asp终极防范SQL注入漏洞】相关文章:

自动采集程序

Asp生成HTML方法大全

asp如何加速网站打开的速度

全面认识ASP注入技巧

简述Xml.Serialization如何序列化对象到XML文件

为什么 Windows2003 的 IIS6.0 不能上传超过 200K 的文件?

ASP防止SQL注入方法

javascript asp教程第八课--request对象

asp防止网页刷新代码

TSYS中生成静态页时溢出: 'CInt'

精品推荐
分类导航