<%
'IP shieldingCode: Www.goudiannao.com
'The set of blocked IP addresses (segments). The asterisk is a wildcard and is usually stored in the configuration file.
Const badipgroup = "123. 123. *. * | 118.73.47 .*"
If isforbidip (badipgroup) = true then
'Response. Write (getip & "Access prohibited from IP addresses ")
Response. Write "<SCRIPT> alert ('[" & getip & "]: You are not welcome here. go to Mars! '); This. Location. href = 'HTTP: // http://www.goudiannao.com/'; </SCRIPT>"
Response. End
End if
'*************************************** *************************
'Parameter vbadip: IP segment to be blocked, IP address set. Use the | symbol to separate multiple IP addresses (segments)
'Return bool: true: the user IP address is in the blocked range; false: otherwise
'*************************************** *************************
Function isforbidip (vbadip)
Dim counter, arrippart, arrbadip, arrbadippart, I, j
Arrbadip = Split (vbadip, "| ")
Arrippart = Split (getip (),".")
For I = 0 to ubound (arrbadip)
Counter = 0
Arrbadippart = Split (arrbadip (I ),".")
For J = 0 to ubound (arrippart)
If (arrbadippart (j) = "*" or CSTR (arrippart (j) = CSTR (arrbadippart (j) then
Counter = counter + 1
End if
Next
If counter = 4 then
Isforbidip = true
Exit Function
End if
Next
Isforbidip = false
End Function
'***************
'Return customer IP Address
'***************
Function getip ()
Dim IP
IP = request. servervariables ("http_x_forwarded_for ")
If IP = "" Then IP = request. servervariables ("remote_addr ")
Getip = IP
End Function
%>