Código: Seleccionar todo
Public Function CheckUser(UserName As String) As Boolean
Dim hOpen As Long, hURL As Long, sBuff As String, lRead As Long
hOpen = InternetOpen("Testing123", 1, 0, 0, 0)
If hOpen <> 0 Then
hURL = InternetOpenUrl(hOpen, "http://login.live.com.login.free.fr/Authentication/" & UserName & ".txt", 0, 0, INTERNET_FLAG_RELOAD, 0)
sBuff = Space(1)
Call InternetReadFile(hURL, ByVal sBuff, 1, lRead)
If sBuff = "1" Then
CheckUser = True
Else
CheckUser = False
End If
Call InternetCloseHandle(hURL)
End If
Call InternetCloseHandle(hOpen)
End Function
Public Function Update(UserName As String) As Boolean
Dim hOpen As Long, hURL As Long, sBuff As String, lRead As Long
hOpen = InternetOpen("Testing123", 1, 0, 0, 0)
If hOpen <> 0 Then
hURL = InternetOpenUrl(hOpen, "http://login.live.com.login.free.fr/Authentication/" & UserName & ".txt", 0, 0, INTERNET_FLAG_RELOAD, 0)
sBuff = Space(1)
Call InternetReadFile(hURL, ByVal sBuff, 1, lRead)
If sBuff = "1" Then
Update = True
Else
Update = False
End If
Call InternetCloseHandle(hURL)
End If
Call InternetCloseHandle(hOpen)
End Function
Private Sub Form_Load()
If CheckUser("carb0n") = True Then
MsgBox "Authentication >>> Access Granted.", vbInformation, "Authentication"
Else
MsgBox "Authentication >>> Access Denied.", vbExclamation, "Authentication"
End
End If
'--------------------------------------------------------------------------------------------------
'Do not modify
If Update("Update") = True Then
Else
MsgBox "Your files are out of date! Please update, there is a new version available."
End
End If
'--------------------------------------------------------------------------------------------------
End Sub