1 Attachment(s)
[IP Banning] MacroHawks Anti-Abuse System
Hello VB Forums Community! This is my first open source vb6 release! It is a Anti-Abuse System or an IP Banner! It uses Winsock and Inet. It connects to a specified web server and reads the text file to find banned IP's. It starts with a form showing your IP. If it is green then it is not banned and if its red that means its banned. And if it is banned it disables the button that allows you to continue with program. The actual code is only 15 lines! The only problem with the program is that it can only read 1 IP from a text file because Inet will only read the first line of the text file and you need to put IP like this:
Code:
127.0.0.1
127.0.0.1
127.0.0.1
So if any one can fix this so that it can read all lines please...please... tell me how! Well any way here is the program. Hope you enjoy!
Re: [IP Banning] MacroHawks Anti-Abuse System
You can change your Form_Load code a little bit to get it done.
vb Code:
Private Sub Form_Load()
Dim Ban As String
Ban = Inet1.OpenURL("http://www.website.com/ban.txt")
Dim arr() As String
Dim i As Integer
Dim flag As Boolean
flag = False
arr = Split(Ban, vbNewLine)
lblIP.Caption = WinsockControl.LocalIP
For i = LBound(arr) To UBound(arr)
If flag = True Then Exit For
If WinsockControl.LocalIP = CStr(arr(i)) Then
flag = True
End If
Next
If flag = True Then
cmdBegin.Enabled = False
lblIP.ForeColor = vbRed
Else
cmdBegin.Enabled = True
lblIP.ForeColor = vbGreen
End If
End Sub
Hope it helps you!!