get要求中怎样避免SQL注入
get要求中避免sql注入的方法:
通过浏览器地址栏传递的数据过滤,例如:
PublicFunctionChkSqlIn()
DimFy_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,"|")
IfRequest.QueryString<>""Then
ForEachFy_GetInRequest.QueryString
ForFy_Xh=0ToUBound(Fy_Inf)
IfInStr(LCase(Request.QueryString(Fy_Get)),Fy_Inf(Fy_Xh))<>0Then
Response.Write"<Script>alert('对不起,可能出错了!');</Script>"
Fy_Get=""
Fy_In=""
Fy_Inf=""
Fy_Xh=""
Response.End
EndIf
Next
Next
EndIf
Fy_Get="":Fy_In="":Fy_Inf="":Fy_Xh=""
EndFunction
本文来源:https://www.yuntue.com/post/62094.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏