home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1995 August / pcpro-0895.iso / code / vb / vb10-4.txt < prev    next >
Encoding:
Text File  |  1995-06-10  |  1.1 KB  |  51 lines

  1. Sub cmdCancel_Click ()
  2. Unload Me
  3. End Sub
  4.  
  5. Sub cmdOK_Click ()
  6. If txtUserName = "" Or txtUserPassword = "" Then
  7.     MsgBox "You must supply both Name and Password.", 16
  8.     Exit Sub
  9. End If
  10.  
  11. If txtConfirmPassword = "" Then
  12.     MsgBox "You must supply the confirmation password.", 16
  13.     Exit Sub
  14. End If
  15.  
  16. If txtUserPassword <> txtConfirmPassword Then
  17.     MsgBox "The New Password and Confirm Password must be the same.", 16
  18.     Exit Sub
  19. End If
  20.  
  21. NewUser = txtUserName
  22.  
  23. Dim Db As database, Ds As dynaset
  24. Set Db = OpenDatabase("e:\vbpass\protect.mdb")
  25. Set Ds = Db.CreateDynaset("select * from mtUserInfo where UserName like '" & txtUserName & "';")
  26.  
  27. If Ds.RecordCount > 0 Then
  28.     MsgBox "An account with that user name already exists on the system!", 16
  29.     Ds.Close
  30.     Db.Close
  31.     Exit Sub
  32. End If
  33.  
  34. Secret$ = txtUserPassword
  35. Password$ = "wibble"
  36. Call Encrypt(Secret$, Password$)
  37.  
  38. Ds.AddNew
  39.     Ds("UserName") = txtUserName
  40.     Ds("UserPassword") = Secret$
  41. Ds.Update
  42. Ds.Close
  43. Db.Close
  44.  
  45. MsgBox "New User Created.", 64
  46.  
  47. Unload Me
  48. End Sub
  49.  
  50.  
  51.