终极防范SQL注入漏洞! -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【meiwen.anslib.com - 电脑资料】

    其实SQL注入漏洞并不可怕,知道原理 + 耐心仔细,就可以彻底防范!下面给出4个函数,足够你抵挡一切SQL注入漏洞!读懂代码,你就能融会贯通,

终极防范SQL注入漏洞!

。注意要对所有的request对象进行过滤:包括 request.cookie, request.ServerVariables 等等容易被忽视的对象:function killn(byval s1) '过滤数值型参数if not isnumeric(s1) then killn=0elseif s10 or s12147483647 then  killn=0else killn=clng(s1)end ifend ifend functionfunction killc(byval s1) 过滤货币型参数if not isnumeric(s1) then killc=0else  killc=formatnumber(s1,2,-1,0,0)end ifend functionfunction killw(byval s1) '过滤字符型参数if len(s1)=0 thenkillw=""elsekillw=trim(replace(s1,"'",""))end ifend functionfunction killbad(byval s1) 过滤所有危险字符,包括跨站脚本If len(s1) = 0 thenkillbad=""elsekillbad = trim(replace(replace(replace(replace(replace(replace(replace(replace(s1,Chr(10), "br"), Chr(34), """), "", "gt;"), "", "lt;"), "", ""),chr(39),"#39"),chr(32),""),chr(13),""))end ifend function
            

最新文章