<%
Dim xh_post, xh_get, xh_cookie, xh_in, xh_inf, xh_xh
Xh_in = "'|; | * | and | Union | declare | exec | insert | select | update | Delete % 20from | drop % 20table | create % 20 table"
Xh_inf = Split (xh_in, "| ")
'-------- Post part ------------------
If request. Form <> "" then
For each xh_post in request. Form
For xh_xh = 0 to ubound (xh_inf)
If instr (lcase (request. Form (xh_post), xh_inf (xh_xh) <> 0 then
Slog ("<br> operation IP Address:" & request. servervariables ("remote_addr") & "<br> operation time:" & now & "<br> operation page:" & request. servervariables ("url") & "<br> submit method: Post <br> submit parameter:" & xh_post & "<br> submit data:" & request. form (xh_post ))
Response. Write "invalid operation"
Response. End
End if
Next
Next
End if
'----------------------------------
'-------- Get part -------------------
If request. querystring <> "then
For each xh_get in request. querystring
For xh_xh = 0 to ubound (xh_inf)
If instr (lcase (request. querystring (xh_get), xh_inf (xh_xh) <> 0 then
Slog ("<br> operation IP Address:" & request. servervariables ("remote_addr") & "<br> operation time:" & now & "<br> operation page:" & request. servervariables ("url") & "<br> submit method: Get <br> submit parameter:" & xh_get & "<br> submit data:" & request. querystring (xh_get ))
Response. Write "invalid operation"
Response. End
End if
Next
Next
End if
'----------------------------------
'-------- Cookie section -------------------
If request. Cookies <> "" then
For each xh_cookie in request. Cookies
For xh_xh = 0 to ubound (xh_inf)
If instr (lcase (request. Cookie (xh_cookie), xh_inf (xh_xh) <> 0 then
Slog ("<br> operation IP Address:" & request. servervariables ("remote_addr") & "<br> operation time:" & now & "<br> operation page:" & request. servervariables ("url") & "<br> submit method: Cookie <br> submit parameter:" & xh_cookie & "<br> submit data:" & request. cookies (xh_cookie ))
Response. Write "invalid operation"
Response. End
End if
Next
Next
End if
Sub slog (logs)
Dim toppath, FS, ts, errorlog
Toppath = server. mappath ("/log.htm ")
Set FS = Createobject ("scripting. FileSystemObject ")
If not fs. fileexists (toppath) then
Set Ts = FS. createtextfile (toppath, true)
TS. Close
End if
Set Ts = FS. opentextfile (toppath, 1)
Do while not ts. atendofstream
Errorlog = errorlog & TS. Readline & CHR (13) & CHR (10)
Loop
TS. Close
Errorlog = errorlog & logs
Set Ts = FS. opentextfile (toppath, 2)
TS. writeline (errorlog)
TS. Close
End sub
%>