Leandro. [Enlace externo eliminado para invitados]:

Este ejemplo sirve para login en NO-IP , para los que ya saben de lo que estoy ablando, con este codigo no es nesesario utilizar la aplicacion que ellos te brindan , sino que ya desde codigo podemos Autentificar nuestra IP. para los que no saven de que ablo NO-IP es un sitio web que te permite hacer que tu ip dinamica sea estatica,pero requieres de una aplicacion externa que deves instalar en tu equipo, si quieren saver como se hace aca un tutorial
bien para conectar utiliza la creacion de un objeto microsoft.xmlhttp, pero esto es opcional ,se pueden usar apis y otras formas , lo mas interesante es el link para el login.

el autor o quien iso las modificaciones es Tengu

cuatro textbox y un command1

Código: Seleccionar todo

Private Sub Command1_Click()
 user = Text1 'tu mail
 pass = Text2 'tu pass
 host = Text3 'tu hostname
 ip = "" 'dejalo vacio para autodetectar
 Text4.Text = UpdateNoIP(user, pass, host, ip)
End Sub
'modificado por Tengu ..::Fireb0y::..

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
 'Clipboard.Clear
 'Clipboard.SetText URL
 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

'modificado por Tengu ..::Fireb0y::..
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
Lo he probado y va bien, pero es una putada que no reconoce el hostname, como hace el no-ip, aquí necesitamos meter 3 datos.

Pero es igual, seguro que le sacaré utilidad de toda forma, gracias amigo por hacer llegar ese tipo de info.

Salu2... A To2...
Imagen
hace tiempo aporte uno = y mucho mejor donde descargaba los DNS automaticamente para que no los ecribieramos y lo mandaron a zona de analisis y nunca lo sacaron de ahi que mala leche :/ y era el codigo fuentee ¬¬ almabo/adwind
Hace un tiempo vi un tuto de como hacerse un NO-IP en VB, os busco la página, y la pongo.

EDIT: Aquí está en un PDF: [Enlace externo eliminado para invitados]

Saludos!
github.com/Slek-Z
Responder

Volver a “Otros lenguajes”