www.pudn.com > noipduc.zip > No-IP-Updater.frm, change:2005-08-09,size:6968b


VERSION 5.00 
Begin VB.Form Form1  
   Caption         =   "Simple No-IP Updater" 
   ClientHeight    =   3165 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   3375 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   3165 
   ScaleWidth      =   3375 
   StartUpPosition =   3  'Windows-Standard 
   Begin VB.CommandButton Command1  
      Caption         =   "Update No-IP service      (www.no-ip.com)" 
      Height          =   495 
      Left            =   120 
      TabIndex        =   8 
      Top             =   1320 
      Width           =   3135 
   End 
   Begin VB.TextBox Text4  
      Height          =   285 
      Left            =   120 
      TabIndex        =   6 
      Top             =   2160 
      Width           =   3135 
   End 
   Begin VB.TextBox Text3  
      Height          =   285 
      Left            =   1080 
      TabIndex        =   4 
      Top             =   840 
      Width           =   2175 
   End 
   Begin VB.TextBox Text2  
      Height          =   285 
      Left            =   1080 
      TabIndex        =   2 
      Top             =   480 
      Width           =   2175 
   End 
   Begin VB.TextBox Text1  
      Height          =   285 
      Left            =   1080 
      TabIndex        =   0 
      Top             =   120 
      Width           =   2175 
   End 
   Begin VB.Label Label5  
      Alignment       =   2  'Zentriert 
      Caption         =   "Be careful with updating because of too many updates will cause a blocking of No-IP services" 
      Height          =   615 
      Left            =   120 
      TabIndex        =   9 
      Top             =   2520 
      Width           =   3015 
   End 
   Begin VB.Label Label4  
      Caption         =   "Status:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   7 
      Top             =   1965 
      Width           =   855 
   End 
   Begin VB.Label Label3  
      Caption         =   "HostName:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   5 
      Top             =   885 
      Width           =   855 
   End 
   Begin VB.Label Label2  
      Caption         =   "Password:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   3 
      Top             =   525 
      Width           =   855 
   End 
   Begin VB.Label Label1  
      Caption         =   "UserName:" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   1 
      Top             =   165 
      Width           =   855 
   End 
End 
Attribute VB_Name = "Form1" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
' *******************    No-IP Updater    ****************** 
' *******************   (C) 2005 JDommi   ****************** 
' *******************  jdommi@t-online.de ****************** 
' 
'                   Free for every use... 
' 
' ********************************************************** 
' *  be careful with updating because of too many updates  * 
' *         will cause a blocking of No-IP services.       * 
' ********************************************************** 
 
Private Sub Command1_Click() 
    user = ""   'your account/username 
    pass = ""   'your password 
    host = ""   'your hostname 
    ip = ""     'your IP or empty for autodetect 
    Text4.Text = UpdateNoIP(user, pass, host, ip) 
End Sub 
 
'routine for updating a No-IP service (www.no-ip.com) 
Function UpdateNoIP(UserName, Password, Hostname, actIP) 
    Dim xmlhttp As Object 
    Dim URL As String 
     
    Set xmlhttp = CreateObject("microsoft.xmlhttp") 
    URL = "http://dynupdate.no-ip.com/dns?username=" & UserName 
    URL = URL & "&password=" & Password & "&hostname=" & Hostname 
    If actIP <> "" Then URL = URL & "&ip=" & actIP 
     
    xmlhttp.open "get", URL, False 
    xmlhttp.SetRequestHeader "Pragma", "no-cache" 
    xmlhttp.SetRequestHeader "Cache-control", "no-cache" 
     
    On Error Resume Next 
    xmlhttp.Send 
     
    If Err.Number <> 0 Then 
        UpdateNoIP = "Error!" 
        Exit Function 
    End If 
     
    If xmlhttp.Status = 200 Then 
        UpdateNoIP = CStr(xmlhttp.responseText) 
    Else 
        If xmlhttp.Status = 401 Then 
            UpdateNoIP = "Authorization Error" 
        Else 
            UpdateNoIP = "Error" 
        End If 
    End If 
     
    If InStr(UpdateNoIP, ":") Then 
        Status = AfterLast(UpdateNoIP, ":") 
        Status = BeforeLast(Status, Chr(10)) 
        Select Case Status 
            Case 0: UpdateNoIP = "Success - IP address is current, no update performed" 
            Case 1: UpdateNoIP = "Success - DNS hostname update successful" 
            Case 2: UpdateNoIP = "Error - Hostname supplied does not exist" 
            Case 3: UpdateNoIP = "Error - Invalid username" 
            Case 4: UpdateNoIP = "Error - Invalid password" 
            Case 5: UpdateNoIP = "Error - Too many updates sent. Updates are blocked until 1 hour passes since last status of 5 returned." 
            Case 6: UpdateNoIP = "Error - Account disabled due to violation of No-IP terms of service. Our terms of service can be viewed at http://www.no-ip.com/legal/tos" 
            Case 7: UpdateNoIP = "Error - Invalid IP. Invalid IP submitted is improperly formated, is a private LAN RFC 1918 address, or an abuse blacklisted address." 
            Case 8: UpdateNoIP = "Error - Disabled / Locked hostname" 
            Case 9: UpdateNoIP = "Host updated is configured as a web redirect and no update was performed." 
            Case 10: UpdateNoIP = "Error - Group supplied does not exist" 
            Case 11: UpdateNoIP = "Success - DNS group update is successful" 
            Case 12: UpdateNoIP = "Success - DNS group is current, no update performed." 
            Case 13: UpdateNoIP = "Error - Update client support not available for supplied hostname or group" 
            Case 14: UpdateNoIP = "Error - Hostname supplied does not have offline settings configured. Returned if sending offline=YES on a host that does not have any offline actions configured." 
            Case 99: UpdateNoIP = "Error - Client disabled. Client should exit and not perform any more updates without user intervention." 
            Case 100: UpdateNoIP = "Error - User input error usually returned if missing required request parameters" 
        End Select 
    End If 
End Function 
 
 
'public string functions 
Function AfterLast(sFrom, sAfterLast) 
    If InStr(1, sFrom, sAfterLast) Then 
        AfterLast = Right(sFrom, Len(sFrom) - InStrRev(sFrom, sAfterLast) - (Len(sAfterLast) - 1)) 
    Else 
        AfterLast = "" 
    End If 
End Function 
 
Function BeforeLast(sIn, sLast) 
    t = AfterLast(sIn, sLast) 
    l = Len(sIn) - Len(t) - Len(sLast) 
    BeforeLast = Left(sIn, l) 
End Function