ASP get post SQL anti-injection function
'----an interception that implements the injection of a GET request-----
Dim sql_injdata,sql_inj,sql_get,sql_post,sql_data
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 (' parameter Error! '); History.back ( -1) </Script> "
Response.End
End If
Next
Next
End If
'----We have to filter the POST request, so we have to keep thinking about Request.Form, which is also in the form of an array, and we just need to go through the loop again to determine the-----
If request.form<> "Then
for each sql_post in Request.Form
for sql_data=0 to Ubound (SQ L_inj)
if InStr (Request.Form (Sql_post), Sql_inj (sql_data)) >0 Then
response.write "<script language=javascript>alert (' parameter Error! '); History.back ( -1) </Script> "
response.end
end if
next
next
End If