<%
'Copy right by safe3 www.safe3.cn
If request. querystring <> "then stopinjection (request. querystring)
If request. Form <> "" Then stopinjection (request. Form)
If request. Cookies <> "" Then stopinjection (request. Cookies)
Function stopinjection (values)
Dim l_get, l_get2, n_get, RegEx, IP
For each n_get in values
For each l_get in values
Rochelle get2 = values (l_get)
Set RegEx = new Regexp
RegEx. ignorecase = true
RegEx. Global = true
RegEx. pattern = "('|; | \ * | declare \ s | \ sand \ s | \ sor \ s | \ sunion \ s | \ bselect \ B | \ bupdate \ B | \ binsert \ B | \. \. /| \. \. \\)"
If RegEx. Test (l_get2) then
IP = request. servervariables ("http_x_forwarded_for ")
If IP = "" then
IP = request. servervariables ("remote_addr ")
End if
Slog ("<br> operation IP:" & IP & "<br> operation time:" & now () & "<br> operation page:" & request. servervariables ("url") & "<br> submission method:" & request. servervariables ("request_method") & "<br> submit parameter:" & l_get & "<br> submit data:" & l_get2)
Response. Write "illegal operation! "
Response. End
End if
Set RegEx = nothing
Next
Next
End Function
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
%>