It is based on a single user name and I want to add more than one user in txt file
you sure?
Dim response As String = web.DownloadString("YOUR ******* ACCOUNT.txt")
If response.Contains(i) Then
If response.Contains(i) Then LoginSuccess = True.
If the text file contains the user/ pass combination, it will count as "logged in."
The code already supports a multi-lined txt file.
Just add more usernames/ passwords to the file. ?
With that said, I'd make a couple changes..
Dim username As String
Dim loginAttempts As Integer= 0
Private Sub LoginButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginButton.Click
If textbox1.Text = "" Or textbox2.Text = "" Then
MsgBox("Username/Password Error ") '' textBox1.Focus() or textBox2.Focus() ?
Exit Sub
End If
loginAttempts += 1
If logins = 4 Then
MsgBox("You have failed 3 times!")
Application.Exit()
End If
Dim web As New WebClient()
Dim userAccount As String = textbox1.Text & ":" & textbox2.Text
Dim response As String = web.DownloadString("YOUR ******* ACCOUNT.txt")
If response.Contains(userAccount) Then
''User/pass was found. Success.
loginAttempts = 0
username = textbox1.Text
MsgBox("Welcome Member : " + username)
Me.Hide()
Else
''User/pass not found.
MsgBox("Invalid Login", MsgBoxStyle.Information)
Exit Sub
End If
End Sub
If anyone can download the password file... I'm not sure of the security involved, but...