欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【好用的asp防SQL注入代码】,下面是详细的分享!
好用的asp防SQL注入代码
dim sql_injdata,SQL_inj,SQL_Get,SQL_Data,Sql_Post
SQL_injdata="'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
SQL_inj=split(SQL_Injdata,"|")
If Request.QueryString<>"" Then
For Each SQL_Get In Request.QueryString
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=javascript>alert('注意:请不要提交非法请求!');history.back(-1)</Script>"
Response.end
end if
next
Next
End If
If Request.Form<>"" Then
For Each Sql_Post In Request.Form
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=javascript>alert('注意:请不要提交非法请求!');history.back(-1)</Script>"
Response.end
end if
next
next
end if
以上所分享的是关于好用的asp防SQL注入代码,下面是编辑为你推荐的有价值的用户互动:
相关问题:求asp字符串过滤防止sql注入等安全选项的过滤代码
答:这个函数可以解决 Function SafeRequest(ParaName,ParaType) '--- 传入参数 --- 'ParaName:参数名称-字符型 'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符) Dim ParaValue ParaValue=Request(ParaName) If ParaType=1 th... >>详细
相关问题:ASP 防SQL注入过滤代码问题??
答:不用这样,如果你的变量是数字型,那用Clng()转一下,如果是日期类型, CDate()一下,如果是其他类型,把单引号替换了就行: Function checkStr(ByVal x, ByVal typ) On Error Rusume Next '如果你是需要整形变量 If typ = "int" Then x = Clng(... >>详细
相关问题:asp.net防注入代码
答:用存储过程来执行所有的查询可以有效避免。下面是一个过滤字符串的函数 /// /// 防注入字符串检查 /// /// 待检查的字符串 /// public static bool StringCheck(string str) { if (str.Trim() == " " || str == null) { return true; } else { R... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
