Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim Array(11) As UserDetails
- Dim i As Byte
- Dim admin As UserDetails
- Dim loggedtrue As Boolean 'The variable controlling whether the user is logged in or not
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- loggedtrue = False
- Array(0).Username = "Bob" 'List of usernames that correlates with the list of passwords
- Array(1).Username = "Anne"
- Array(2).Username = "Steve"
- Array(3).Username = "Glen"
- Array(4).Username = "Marry"
- Array(4).Username = "Dave"
- Array(5).Username = "John"
- Array(6).Username = "Rose"
- Array(7).Username = "Barbra"
- Array(8).Username = "Charles"
- Array(9).Username = "Jake"
- Array(10).Username = "Lina"
- Array(11).Username = "Admin01"
- Array(0).Password = "dogo" 'List of the passwords that correlates with the list of usernames
- Array(1).Password = "Frank"
- Array(2).Password = "felix"
- Array(3).Password = "indication"
- Array(4).Password = "dankmeme"
- Array(5).Password = "ace"
- Array(6).Password = "correlation"
- Array(7).Password = "selection"
- Array(8).Password = "discussion"
- Array(9).Password = "history"
- Array(10).Password = "cerial"
- Array(11).Password = "tune"
- admin.Username = "admin"
- admin.Password = "admin"
- End Sub
- Private Structure UserDetails 'Is another structure independent of the rest containing different variables
- Dim Username As String
- Dim Password As String
- End Structure
- Private Sub ButtonLogin_Click_1(sender As Object, e As EventArgs) Handles ButtonLogin.Click
- For i = 0 To 11 'This means that for every value it will go between 0 and 11
- 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
- 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
- loggedtrue = True
- MsgBox("Welcome!")
- End If
- End If
- Next
- If loggedtrue = True Then 'This is displayed if admin logs in
- If admin.Password = TextBox2.Text Then
- MsgBox("You have full accsess")
- End If
- Else
- TextBox1.Text = Nothing 'This code clears the textboxs and tells the user their entered credentials were false
- TextBox2.Text = Nothing
- MsgBox("Please enter valid credentials")
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement