1. 程式人生 > >ASPSecurity SQL 防註入

ASPSecurity SQL 防註入

form select next win sde sub col fun pda

<%
************** ASPSecurity SQL 防註入************** Copyright 2006 Create:2006-4-06 Update:2006-6-01***************************************************
 
If Request.Form<>"" Then StopInjection(Request.Form)
If Request.QueryString<>"" Then StopInjection(Request.QueryString)
If Request.Cookies
<>"" Then StopInjection(Request.Cookies) Function StopInjection(values) For Each N_Get In values Dim L_Get, L_Get2 For Each L_Get In values L_Get2 = values(L_Get) Set regEx = New RegExp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "(\bselect\b|\sand\s|‘|\sdeclare\s)
" If regEx.Test(L_Get2) Then Alert() response.End() End If Set regEx = Nothing Next Next End Function Sub Alert() Dim str str = "<"&"Script Language=JavaScript"&">" str = str & "alert(‘== 雷客圖ASP站長安全助手檢測到了危險字符,已經禁止本次提交 ==\n‘);window.close();" str = str & "
<"&"/Script"&">" response.write str End Sub %>

ASPSecurity SQL 防註入