相關資訊
本類常用軟件
-
福建農村信用社手機銀行客戶端下載下載量:584204
-
Windows優化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農村信用社手機銀行客戶端下載下載量:365699
-
快播手機版下載量:325855
本文提供給大家分享的是ASP通用防注入代碼,杜絕SQL注入隱患,提升網站安全,希望對大家有所幫助。
<%
''''''''''''''''''''''''''''''''''''''''''''''''
'ASP通用防注入代碼
'您可以把該代碼COPY到頭文件中.也可以單獨作
'為一個文件存在,每次調用使用
'作者:y3gu - 2005-7-29
''''''''''''''''''''''''''''''''''''''''''''''''
Dim GetFlag Rem(提交方式)
Dim ErrorSql Rem(非法字符)
Dim RequestKey Rem(提交數據)
Dim ForI Rem(循環標記)
ErrorSql = "'~;~and~(~)~exec~update~count~*~%~chr~mid~master~truncate~char~declare" Rem(每個敏感字符或者詞語請使用半角 "~" 格開)
ErrorSql = split(ErrorSql,"~")
If Request.ServerVariables("REQUEST_METHOD")="GET" Then
GetFlag=True
Else
GetFlag=False
End If
If GetFlag Then
For Each RequestKey In Request.QueryString
For ForI=0 To Ubound(ErrorSql)
If Instr(LCase(Request.QueryString(RequestKey)),ErrorSql(ForI))<>0 Then
response.write "<script>alert(""警告:\n請不要使用敏感字符"");location.href=""Sql.asp"";</script>"
Response.End
End If
Next
Next
Else
For Each RequestKey In Request.Form
For ForI=0 To Ubound(ErrorSql)
If Instr(LCase(Request.Form(RequestKey)),ErrorSql(ForI))<>0 Then
response.write "<script>alert(""警告:\n請不要使用敏感字符"");location.href=""Sql.asp"";</script>"
Response.End
End If
Next
Next
End If
%>
''''''''''''''''''''''''''''''''''''''''''''''''
'ASP通用防注入代碼
'您可以把該代碼COPY到頭文件中.也可以單獨作
'為一個文件存在,每次調用使用
'作者:y3gu - 2005-7-29
''''''''''''''''''''''''''''''''''''''''''''''''
Dim GetFlag Rem(提交方式)
Dim ErrorSql Rem(非法字符)
Dim RequestKey Rem(提交數據)
Dim ForI Rem(循環標記)
ErrorSql = "'~;~and~(~)~exec~update~count~*~%~chr~mid~master~truncate~char~declare" Rem(每個敏感字符或者詞語請使用半角 "~" 格開)
ErrorSql = split(ErrorSql,"~")
If Request.ServerVariables("REQUEST_METHOD")="GET" Then
GetFlag=True
Else
GetFlag=False
End If
If GetFlag Then
For Each RequestKey In Request.QueryString
For ForI=0 To Ubound(ErrorSql)
If Instr(LCase(Request.QueryString(RequestKey)),ErrorSql(ForI))<>0 Then
response.write "<script>alert(""警告:\n請不要使用敏感字符"");location.href=""Sql.asp"";</script>"
Response.End
End If
Next
Next
Else
For Each RequestKey In Request.Form
For ForI=0 To Ubound(ErrorSql)
If Instr(LCase(Request.Form(RequestKey)),ErrorSql(ForI))<>0 Then
response.write "<script>alert(""警告:\n請不要使用敏感字符"");location.href=""Sql.asp"";</script>"
Response.End
End If
Next
Next
End If
%>
熱門評論
最新評論