asp 获取参数值与sql安全过滤参数函数代码
2018-10-12 14:11
666 查看
'获取参数值
Function getForm(element,ftype)
Select case ftype
case "get"
getForm=trim(request.QueryString(element))
case "post"
getForm=trim(request.Form(element))
case "both"
if isNul(request.QueryString(element)) then getForm=trim(request.Form(element)) else getForm=trim(request.QueryString(element))
End Select
getForm=replace(getForm,CHR(34),""")
getForm=replace(getForm,CHR(39),"'")
End Function
'主要功能就是获取参数值,比直接用request("element")要安全很多
'过滤参数
Function filterPara(byVal Para)
filterPara=preventSqlin(Checkxss(Para))
End Function
Function preventSqlin(content)
dim sqlStr,sqlArray,i,speStr
sqlStr="<|>|%|%27|'|''|;|*|and|exec|dbcc|alter|drop|insert|select|update|delete|count|master|truncate|char|declare|where|set|declare|mid|chr"
if isNul(content) then Exit Function
sqlArray=split(sqlStr,"|")
for i=lbound(sqlArray) to ubound(sqlArray)
if instr(lcase(content),sqlArray(i))<>0 then
select case sqlArray(i)
case "<":speStr="<"
case ">":speStr=">"
case "'","""":speStr="""
'case ";":speStr=";"
case else:speStr=""
end select
content=replace(content,sqlArray(i),speStr,1,-1,1)
end if
next
preventSqlin=content
End Function
'上面的参数过滤函主要是防止sql注入,加强的防护。
相关文章推荐
- asp 获取参数值与sql安全过滤参数函数代码
- asp中获取当前页面的地址与参数的函数代码
- asp中获取当前页面的地址与参数的函数代码
- C#(ASP.NET)正则表达式 过滤危险字符函数代码 防SQL注入 很全面的SQL关键字过滤
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- javascript 获取url参数和script标签中获取url参数函数代码
- setTimeout传递带参数的函数问题,jquery获取参数值的问题
- javascript获取函数名称、函数参数、对象属性名称的代码实例
- 做了CDN获取用户真实IP的函数代码(PHP与Asp设置方式)
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- asp获取文件名和扩展名的函数代码
- asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
- php 对输入信息的进行安全过滤的函数代码
- php 安全过滤函数代码