Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.IO
- Public Class Login
- Public username As String
- Public password As String
- Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- chkAuto.Checked = My.Settings.Checked
- username = My.Settings.Username
- password = My.Settings.Password
- frmDirectory.directory = My.Settings.Directory
- If frmDirectory.directory = "" Or frmDirectory.directory = "0" Then
- frmDirectory.Show()
- My.Settings.background = Color.RoyalBlue
- Me.Close()
- Else
- lblIncorrect.Hide()
- txtUsername.Select()
- txtUsername.Text = username
- Dim myIPaddress As String
- Dim tmpHostName As String = System.Net.Dns.GetHostName()
- myIPaddress = System.Net.Dns.GetHostByName(tmpHostName).AddressList(0).ToString()
- If My.Computer.FileSystem.FileExists(frmDirectory.directory) Then
- If My.Computer.FileSystem.ReadAllText(frmDirectory.directory).Contains(myIPaddress) Then
- Else
- frmCreate.Show()
- Me.Close()
- End If
- Else
- frmDirectory.Show()
- Me.Close()
- End If
- End If
- End Sub
- Private Sub Login_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- My.Settings.Username = username
- My.Settings.Password = password
- If chkAuto.Checked = True Then
- My.Settings.Checked = chkAuto.Checked = True
- ElseIf chkAuto.Checked = False Then
- My.Settings.Checked = False
- End If
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- If txtUsername.Text = username And txtPassword.Text = password Then
- frmMain.Show()
- Me.Close()
- Else
- Timer3.Start()
- txtPassword.Clear()
- Timer1.Start()
- End If
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- frmCreate.Show()
- Me.Close()
- End Sub
- Private Sub txtPassword_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles txtPassword.KeyDown
- If e.KeyCode = Keys.Enter Then
- Button2.PerformClick()
- End If
- End Sub
- Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
- lblIncorrect.Show()
- Timer2.Start()
- End Sub
- Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
- Timer1.Stop()
- lblIncorrect.Hide()
- Timer2.Stop()
- End Sub
- Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
- Dim myIPaddress As String
- Dim tmpHostName As String = System.Net.Dns.GetHostName()
- myIPaddress = System.Net.Dns.GetHostByName(tmpHostName).AddressList(0).ToString()
- Select Case MsgBox("Are you sure you want to delete your account?", MsgBoxStyle.YesNo, "Remove Account?")
- Case MsgBoxResult.Yes
- Dim lines As New List(Of String)
- Using sr As New StreamReader(My.Settings.Directory)
- While Not sr.EndOfStream
- lines.Add(sr.ReadLine)
- End While
- End Using
- For Each line As String In lines
- If line.Contains(myIPaddress & username & password) Then
- lines.Remove(line)
- Exit For
- End If
- Next
- Using sw As New StreamWriter(My.Settings.Directory)
- For Each line As String In lines
- sw.WriteLine(line)
- Next
- End Using
- frmCreate.Show()
- Me.Close()
- Case MsgBoxResult.No
- End Select
- End Sub
- Private Sub txtUsername_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtUsername.TextChanged
- If txtUsername.Text = username Then
- txtPassword.Select()
- End If
- End Sub
- Private Sub Timer3_Tick(sender As System.Object, e As System.EventArgs) Handles Timer3.Tick
- txtUsername.Enabled = False
- txtPassword.Enabled = False
- Timer4.Start()
- End Sub
- Private Sub Timer4_Tick(sender As System.Object, e As System.EventArgs) Handles Timer4.Tick
- Timer3.Stop()
- txtPassword.Text = ""
- txtUsername.Enabled = True
- txtPassword.Enabled = True
- txtPassword.Select()
- Timer4.Stop()
- End Sub
- Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
- frmDirectory.Show()
- End Sub
- Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
- frmHelp.Show()
- End Sub
- Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
- Process.Start("http://phobicos.webs.com/")
- End Sub
- Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
- Application.Exit()
- End Sub
- Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
- Application.Restart()
- End Sub
- Private Sub chkAuto_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAuto.CheckedChanged
- If chkAuto.Checked = True Then
- txtPassword.PasswordChar = "⊗"
- Else
- txtPassword.PasswordChar = Nothing
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement