Advertisement
Guest User

Untitled

a guest
Jun 20th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. Public Class Form1
  2. Dim Array(11) As UserDetails
  3. Dim i As Byte
  4. Dim admin As UserDetails
  5. Dim loggedtrue As Boolean 'The variable controlling whether the user is logged in or not
  6. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  7.  
  8. loggedtrue = False
  9. Array(0).Username = "Bob" 'List of usernames that correlates with the list of passwords
  10. Array(1).Username = "Anne"
  11. Array(2).Username = "Steve"
  12. Array(3).Username = "Glen"
  13. Array(4).Username = "Marry"
  14. Array(4).Username = "Dave"
  15. Array(5).Username = "John"
  16. Array(6).Username = "Rose"
  17. Array(7).Username = "Barbra"
  18. Array(8).Username = "Charles"
  19. Array(9).Username = "Jake"
  20. Array(10).Username = "Lina"
  21. Array(11).Username = "Admin01"
  22. Array(0).Password = "dogo" 'List of the passwords that correlates with the list of usernames
  23. Array(1).Password = "Frank"
  24. Array(2).Password = "felix"
  25. Array(3).Password = "indication"
  26. Array(4).Password = "dankmeme"
  27. Array(5).Password = "ace"
  28. Array(6).Password = "correlation"
  29. Array(7).Password = "selection"
  30. Array(8).Password = "discussion"
  31. Array(9).Password = "history"
  32. Array(10).Password = "cerial"
  33. Array(11).Password = "tune"
  34. admin.Username = "admin"
  35. admin.Password = "admin"
  36. End Sub
  37.  
  38. Private Structure UserDetails 'Is another structure independent of the rest containing different variables
  39. Dim Username As String
  40. Dim Password As String
  41.  
  42. End Structure
  43.  
  44. Private Sub ButtonLogin_Click_1(sender As Object, e As EventArgs) Handles ButtonLogin.Click
  45. For i = 0 To 11 'This means that for every value it will go between 0 and 11
  46. If loggedtrue = False Then 'This code checks if the username and password is correct or admin and if it is correct or admin it messages the user
  47. If (TextBox1.Text).ToLower = (Array(i).Username).ToLower And (Array(i).Password).ToLower = (TextBox2.Text).ToLower Or admin.Password = Array(i).Password And admin.Username = Array(i).Password Then
  48. loggedtrue = True
  49. MsgBox("Welcome!")
  50. End If
  51. End If
  52. Next
  53. If loggedtrue = True Then 'This is displayed if admin logs in
  54. If admin.Password = TextBox2.Text Then
  55. MsgBox("You have full accsess")
  56. End If
  57. Else
  58. TextBox1.Text = Nothing 'This code clears the textboxs and tells the user their entered credentials were false
  59. TextBox2.Text = Nothing
  60. MsgBox("Please enter valid credentials")
  61. End If
  62. End Sub
  63. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement