NOTE: Reprint please indicate the source
On Error Resume Next ' This line of code is placed in the first line of conn.asp.
' Prevent injection
Dim qs,errc,iii
Qs=request.servervariables ("Query_string")
' Response.Write (QS)
Dim destr (18)
DESTR (0) = "NET user"
DESTR (1) = "xp_cmdshell"
DESTR (2) = "/add"
DESTR (3) = "Exec%20master.dbo.xp_cmdshell"
DESTR (4) = "Net localgroup Administrators"
DESTR (5) = "Select"
DESTR (6) = "Count"
DESTR (7) = "ASC"
DESTR (8) = "char"
DESTR (9) = "Mid"
DESTR (10) = "'"
DESTR (11) = ":"
DESTR (12) = "" "
DESTR (+) = "Insert"
destr = "Delete"
DESTR = "Drop"
DESTR = "Truncate"
Destr (a) = "from"
DESTR (18) = "%"
Errc=false
For iii= 0 To UBound (DESTR)
If InStr (QS,DESTR (iii)) <>0 then
Errc=true
End If
Next
If ERRC Then
Response.Write ("Sorry, illegal URL address request!")
Response.End
End If
Put this code in your database connection file like conn.asp. Insert it in front of the database connection code. Because all connection library files are to include conn.asp this file, so for each page, if there is an illegal injection, then we can stop the execution of the page before the database connection. To achieve the total station to prevent injection function.