Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub LoadAccount()
- currentfilereader = New StreamReader(filename)
- Dim Seperator As Char = " "c
- For count As Integer = 0 To NumUsers - 1
- textstring = currentfilereader.ReadLine
- Dim words() As String = currentfilereader.ReadLine.Split(Seperator)
- Username = words(0)
- Password = words(1)
- If words(2) = "1" Then
- AccessGranted = True
- Else
- AccessGranted = False
- End If
- Users(count, 0) = Username
- Users(count, 1) = Password
- Users(count, 2) = AccessGranted
- Next
- currentfilereader.Close()
- End Sub
- Public Sub Login()
- Dim InvalidUsername, InvalidPassword As Boolean
- InvalidUsername = True
- InvalidPassword = True
- LoginName = Form1.tbun.Text
- LoginPassword = Form1.tbpw.Text
- For count As Integer = 0 To NumUsers - 1
- If LoginName = Users(count, 0) Then
- InvalidUsername = False
- If LoginPassword = Users(count, 1) Then
- InvalidPassword = False
- CurrentUsername = LoginName
- CurrentPassword = LoginPassword
- CurrentAccessGranted = Users(count, 2)
- loggedin = True
- Else
- MsgBox("Invalid Password")
- End If
- Else
- MsgBox("Invalid Username")
- End If
- Next
- End Sub
- Public Sub NumberOfUsers()
- currentfilereader = New StreamReader(filename)
- NumUsers = File.ReadAllLines("Accounts.txt").Length
- MsgBox("There are " & NumUsers & " users")
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement