Imports MySql.Data.MySqlClient Public Class LoginForm1 Public sCon As MySqlConnection = New MySqlConnection Public sComand As MySqlDataAdapter = New MySqlDataAdapter Public ds As DataSet = New DataSet Dim scrollVal As Integer Dim pagingAdapter As MySqlDataAdapter Dim pagingDS As DataSet Dim pagingDS2 As DataSet 'Private sRecord_Count As Integer Dim conn As MySqlConnection Dim cmd As MySqlCommand Dim dr As MySqlDataReader Private Sub LoginForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Label1.Visible = False End Sub Private Sub connclos() Try conn.Close() conn.Dispose() MySqlConnection.ClearPool(conn) Catch ex As Exception End Try End Sub Private Sub conns() Try conn = New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") conn.Open() Catch ex As Exception MessageBox.Show("Please Close to finish update 5 seconds & Open the program again. Or contact the programmer", "hhl no connection", MessageBoxButtons.OK, MessageBoxIcon.Error) End End Try End Sub Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click conns() cmd = New MySqlCommand("SELECT * FROM elusersdb where eluser = '" & UsernameTextBox.Text & "' and elpass = '" & Encryptel(PasswordTextBox.Text, 1) & "'", conn) dr = cmd.ExecuteReader If (dr.Read) Then Label1.Text = dr("elrole") If Label1.Text = "a0" Then Dashboard.Show() Dashboard.Label17.Text = UsernameTextBox.Text backuperel() Me.Hide() ElseIf Label1.Text = "a1" Then Dashboard.Show() Dashboard.Label17.Text = UsernameTextBox.Text backuperel() Me.Hide() ElseIf Label1.Text = "a2" Then Dashboard.Show() Dashboard.Label17.Text = UsernameTextBox.Text backuperel() Me.Hide() End If conns() cmd = New MySqlCommand("Update elusersdb set lastlogin = 'now' where eluser = '" & UsernameTextBox.Text & "'", conn) cmd.ExecuteNonQuery() conn.Close() MySqlConnection.ClearAllPools() Else MsgBox("Wrong Username or Password", MsgBoxStyle.Information, "Login") End If connclos() 'conclos() 'If UsernameTextBox.Text = "lhoy" And PasswordTextBox.Text = "lhoyaccess123" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "lhoy" ' backuperel() ' Me.Hide() 'ElseIf UsernameTextBox.Text = "jeleen1231123123" And PasswordTextBox.Text = "1231123123jeleenmj0708" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "jeleen" ' backuperel() ' Me.Hide() 'ElseIf UsernameTextBox.Text = "edgie" And PasswordTextBox.Text = "edgie1434" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "edgie" ' backuperel() ' Me.Hide() 'ElseIf UsernameTextBox.Text = "she1231123123" And PasswordTextBox.Text = "1231123123shemj0304" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "she" ' backuperel() ' Me.Hide() 'ElseIf UsernameTextBox.Text = "jp1231123123" And PasswordTextBox.Text = "1231123123jpmj0506" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "jp" ' backuperel() ' Me.Hide() 'ElseIf UsernameTextBox.Text = "EL" And PasswordTextBox.Text = "elasdf.1234" Then ' Dashboard.Show() ' Dashboard.Label17.Text = "EL" ' backuperel() ' Me.Hide() 'Else ' MsgBox("Wrong Username or Password", MsgBoxStyle.Information, "Login") 'End If End Sub Sub backuperel() If Label1.Text = "a0" Then Dashboard.Button7.Visible = True Dashboard.Button8.Visible = True Dashboard.Button14.Visible = True Dashboard.TextBox1.Visible = True Dashboard.Button10.Visible = True Dashboard.Button18.Visible = True Else Dashboard.Button7.Visible = False Dashboard.Button8.Visible = False Dashboard.Button14.Visible = False Dashboard.TextBox1.Visible = False Dashboard.Button10.Visible = False Dashboard.Button12.Visible = False Dashboard.Button16.Visible = False Dashboard.Button17.Visible = False Dashboard.Button15.Visible = False Dashboard.Button18.Visible = False End If If Label1.Text = "a1" Or Label1.Text = "a0" Then Dashboard.Button9.Visible = True Dashboard.Button12.Visible = True Dashboard.Button16.Visible = True Dashboard.Button17.Visible = True Dashboard.Button15.Visible = True Else Dashboard.Button9.Visible = False End If End Sub Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub End Class