相關(guān)資訊
本類常用軟件
-
福建農(nóng)村信用社手機(jī)銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機(jī)銀行客戶端下載下載量:365699
-
快播手機(jī)版下載量:325855
每日一囧
本文提供給大家分享的是ASP通用防注入代碼,杜絕SQL注入隱患,提升網(wǎng)站安全,希望對大家有所幫助。
<%
''''''''''''''''''''''''''''''''''''''''''''''''
'ASP通用防注入代碼
'您可以把該代碼COPY到頭文件中.也可以單獨(dú)作
'為一個(gè)文件存在,每次調(diào)用使用
'作者:y3gu - 2005-7-29
''''''''''''''''''''''''''''''''''''''''''''''''
Dim GetFlag Rem(提交方式)
Dim ErrorSql Rem(非法字符)
Dim RequestKey Rem(提交數(shù)據(jù))
Dim ForI Rem(循環(huán)標(biāo)記)
ErrorSql = "'~;~and~(~)~exec~update~count~*~%~chr~mid~master~truncate~char~declare" Rem(每個(gè)敏感字符或者詞語請使用半角 "~" 格開)
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到頭文件中.也可以單獨(dú)作
'為一個(gè)文件存在,每次調(diào)用使用
'作者:y3gu - 2005-7-29
''''''''''''''''''''''''''''''''''''''''''''''''
Dim GetFlag Rem(提交方式)
Dim ErrorSql Rem(非法字符)
Dim RequestKey Rem(提交數(shù)據(jù))
Dim ForI Rem(循環(huán)標(biāo)記)
ErrorSql = "'~;~and~(~)~exec~update~count~*~%~chr~mid~master~truncate~char~declare" Rem(每個(gè)敏感字符或者詞語請使用半角 "~" 格開)
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
%>
熱門評(píng)論
最新評(píng)論