文章摘要:get请求中如何防止sql注入 get sql注入
get请求中防止sql注入的方法: 通过浏览器地址栏传递的数据过滤,例如: Public Funct […]
get请求中防止sql注入的方法:
通过浏览器地址栏传递的数据过滤,例如:
Public Function ChkSqlIn()
Dim Fy_Get, Fy_In, Fy_Inf, Fy_Xh
Fy_In = "'|;|or|and|(|)|*|%|exec|insert|select|delete|update|count|chr|char|nchar|asc|
unicode|mid|substring|master|truncate|drop|declare|%20from|cmdshell|admin|net%20user
|net%20localgroup|1=1|1=2|user>0|id=1"
Fy_Inf = Split(Fy_In, "|")
If Request.QueryString <> "" Then
For Each Fy_Get In Request.QueryString
For Fy_Xh = 0 To UBound(Fy_Inf)
If InStr(LCase(Request.QueryString(Fy_Get)), Fy_Inf(Fy_Xh)) <> 0 Then
Response.Write "<Script>alert('对不起,可能出错了!');</Script>"
Fy_Get = ""
Fy_In = ""
Fy_Inf = ""
Fy_Xh = ""
Response.End
End If
Next
Next
End If
Fy_Get = "": Fy_In = "": Fy_Inf = "": Fy_Xh = ""
End Function