Private Sub Enrg_Click() Open App.Path & "/Log.txt" For Append As #1 Write #1, CrypteAscii(Txtuser), CrypteAscii(TxtPass) Close #1 MsgBox "enregistrer...." End Sub Private Sub Log_Click() Dim User As String Dim Pass As String Dim Correct As Boolean Correct = False If Dir(App.Path & "/log.txt") = "" Then Exit Sub Open App.Path & "/log.txt" For Input As #1 Do While Not EOF(1) Input #1, User, Pass If DecrypteAscii(User) Txtuser And DecrypteAscii(Pass) TxtPass Then Correct = True: Exit Do Loop Close #1 If Correct Then MsgBox "Ok" Else MsgBox "Incorrect..." End Sub Public Function CrypteAscii(txt As String) Dim tmp As String For i = 1 To Len(txt) tmp = tmp & Asc(Mid(txt, i, 1)) & "." Next i CrypteAscii = tmp End Function Public Function DecrypteAscii(txt As String) Dim tmp() As String Dim tmp2 As String tmp = Split(txt, ".") For i = 0 To UBound(tmp) On Error Resume Next tmp2 = tmp2 & Chr(tmp(i)) Next i DecrypteAscii = tmp2 End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question