Results 1 to 2 of 2

Thread: [IP Banning] MacroHawks Anti-Abuse System

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    26

    [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!
    Attached Files Attached Files

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [IP Banning] MacroHawks Anti-Abuse System

    You can change your Form_Load code a little bit to get it done.
    vb Code:
    1. Private Sub Form_Load()
    2. Dim Ban As String
    3.  
    4. Ban = Inet1.OpenURL("http://www.website.com/ban.txt")
    5.  
    6. Dim arr() As String
    7. Dim i As Integer
    8. Dim flag As Boolean
    9. flag = False
    10.  
    11. arr = Split(Ban, vbNewLine)
    12. lblIP.Caption = WinsockControl.LocalIP
    13.  
    14. For i = LBound(arr) To UBound(arr)
    15.     If flag = True Then Exit For
    16.         If WinsockControl.LocalIP = CStr(arr(i)) Then
    17.             flag = True
    18.         End If
    19. Next
    20.  
    21. If flag = True Then
    22.     cmdBegin.Enabled = False
    23.     lblIP.ForeColor = vbRed
    24. Else
    25.     cmdBegin.Enabled = True
    26.     lblIP.ForeColor = vbGreen
    27. End If
    28. End Sub
    Hope it helps you!!
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width