示例#1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            curd_functions  curd1 = new curd_functions();
            string          sql   = "SELECT username, password FROM user_account";
            MySqlDataReader data  = curd1.SelectQ(sql);


            string server_username = "";
            string server_password = "";

            while (data.Read())
            {
                server_username = data.GetString("username");
                server_password = data.GetString("password");
            }


            string entered_username = username.Text;
            string entered_password = password.Text;


            if (entered_username == server_username && entered_password == server_password)
            {
                loading_screen LS = new loading_screen();
                LS.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Password or username is invalid", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                username.Clear();
                password.Clear();
                username.Focus();
            }
        }