I got this code, I think from Nikkol some time ago:
strRemIP = Request.ServerVariables("REMOTE_ADDR")
strBanIP = Mid(strRemIP, 1, InStrRev(strRemIP,"."))
This gives the IP address up to the last period, which is great for banning entire ranges. But now I have a limited range of IP addresses (say xx.xx.xx.53 to xx.xx.xx.71) that I want banned.
What would be the easiest way to check if the visitor's IP address fits in that range?
I was thinking... maybe I should first using the code shown above and then get the last part of the visitor's IP address (let's say I call that strLastIPpart) and check that against the two numbers in the range?
if strBanIP = "xx.xx.xx" then
if strLastPPpart => 64 or strLastIPpart =< 79 then
redirect
end if
end if
Also, how would I get the last part of an IP address? I don't quite grasp how that Mid function works, and w3school.com didn't really help...