Message Board

http:BL Use/Development

Older Posts ]   [ Newer Posts ]
 Working code for asp
Author: J.Night   (18 Feb 09 4:14pm)
'code start (have this running from a master include file)
'block hostle IP's
response.buffer = true
'using session to try to only query first time user come in
if Session("IPCheck") = "" then
on error resume next
Dim WordArray,accesskey
accesskey = "yourkeyhere"
WordArray = Split(Request.ServerVariables("REMOTE_ADDR"), ".")
ipaddy = WordArray(3) & "." & WordArray(2) & "." & WordArray(1) & "." & WordArray(0)
Set WordArray = Nothing
dnsquery = accesskey & "." & ipaddy & ".dnsbl.httpbl.org"
Dim DNS
Dim A
Set DNS = Server.CreateObject("ASPDNS.DNSLookup")
A = DNS.GetIPFromName(dnsquery)
Set DNS = Nothing
WordArray2 = Split(A, ".")
If WordArray2(0) = "127" then
'I'm using 10 as my kill point
If WordArray2(2) >= 10 Then
Session("IPCheck") = "False"
KillIt = 1
'log it if you want here
set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set myfile = FSO.OpenTextFile("d:\logs\RejectedIPs\SiteName_Rejected_" & FormatDateTime(Now(),1) & ".txt", 8,true)
myfile.writeline Request.ServerVariables("REMOTE_ADDR")
myfile.close
set myfile = nothing
set fso = nothing
else
Session("IPCheck") = "True"
end if
Else
Session("IPCheck") = "True"
End If
Set WordArray2 = Nothing
if KillIt = 1 then
response.write "You must allow cookies to use this site"
response.end
end if
end if
'code done

if anyone see any issues, let me know

the dns dll got for free here
http://www.internext.co.za/stefan/aspdns/



do not follow this link

Privacy Policy | Terms of Use | About Project Honey Pot | FAQ | Cloudflare Site Protection | Contact Us

Copyright © 2004–17, Unspam Technologies, Inc. All rights reserved.

contact | wiki | email