Results 1 to 2 of 2

Thread: enrypt decrypt

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    7

    enrypt decrypt

    Hello VB people

    could you help me solve my problem in decrypting and encrypting. Im using Visual Basic 6.0 as front end and MS ACCESS 2003 as my back end.
    My problem is even i enter the correct user name and password still the message box is "Unauthorized user"

    Here is my code to check.

    Private Sub Command1_Click()
    Static counter As Integer
    Set userdb = OpenDatabase(App.Path & "\finance.mdb")
    Set usertb = userdb.OpenRecordset("Login", dbOpenTable)
    usertb.Index = "Uname"
    usertb.Seek "=", Text1.Text
    If usertb.NoMatch Then
    MsgBox "User ID is not valid", vbInformation
    x.Text = Val(x.Text) + 1
    Text1.Text = ""
    Text2.Text = ""
    Text1.SetFocus

    If Val(x.Text) > 3 Then
    MsgBox "Unauthorized user"
    Unload Me
    Exit Sub
    End If

    Else
    If Decrypt(usertb.Fields("Pass")) = Text2.Text Then
    VarTest = 0

    Command1.Visible = False
    Command2.Visible = False

    MsgBox "user access granted"
    uservar = Text1.Text
    usertb.Close
    userdb.Close
    MAIN.Show
    Unload Me
    Else
    MsgBox ("Wrong password")
    x.Text = Val(x.Text) + 1
    Text1.Text = ""
    Text2.Text = ""
    Text1.SetFocus
    If Val(x.Text) > 3 Then
    MsgBox "**** ka!", vbInformation
    Unload Me
    Exit Sub
    End If
    End If
    End If

    End Sub

    Module:
    Global VarTest As String
    Global CatchLogger As String
    Global LoggeR As String

    Function Encrypt(InputTxt As String)
    For ctr = 1 To Len(InputTxt)
    Encrypt = Encrypt + Chr(Asc(Mid(InputTxt, ctr, 1)) + 69)
    Next ctr
    End Function

    Function Decrypt(InputTxt As String)
    For ctr = 1 To Len(InputTxt)
    Decrypt = Decrypt + Chr(Asc(Mid(InputTxt, ctr, 1)) - 69)
    Next ctr
    End Function

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: enrypt decrypt

    Quote Originally Posted by naughtyboy_ading
    Im using Visual Basic 6.0 as front end and MS ACCESS 2003 as my back end.
    Wrong forum. You posted in the Visual Basic .Net forum. You want the Classic VB forum.

    Hopefully a mod will move this shortly
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

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