programming-examples/asp/More_Code_Snippets/Block more than one IP address.asp

21 lines
532 B
Plaintext
Raw Permalink Normal View History

2019-11-18 14:25:58 +01:00
<%
'declare our variables
Dim strIP
Dim intBanned
Dim arrIP(1)
'these are our blocked IP addresses
arrIP(0) = "127.0.0.01"
arrIP(1) = "100.45.76.80"
'get the users IP address
strIP = Request.ServerVariables("LOCAL_ADDR")
intBanned = 1
'loop through the banned IP addresses
For i = 0 to intBanned
'display a message and stop processing the page
If strIP = arrIP(intBanned) Then
Response.Write "You are blocked from this site"
Response.End
End If
Next
'a welcome message if IP is OK
response.Wr