Ejemplo n.º 1
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            Form meniu = new Meniu();

            this.Hide();
            meniu.Show();
        }
Ejemplo n.º 2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            if (RememberBOX.Checked)
            {
                RememberCrd("SaveCredentials");
            }
            else
            {
                RememberCrd("DeleteCredentials");
            }

            string nume   = metroTextBox1.Text;
            string parola = metroTextBox2.Text;
            string idpc   = Hashhhh(); idpc.Replace(" ", ""); idpc = ConvertStringToHex(idpc);

            // MessageBox.Show(idpc);
            string connString = "SERVER = " + sql.ip + ";PORT=" + sql.port + ";DATABASE=" + sql.database + ";UID=" + sql.username + ";PASSWORD='******'";

            try
            {
                conn = new MySqlConnection();
                conn.ConnectionString = connString;
                conn.Open();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Eroare 142 / Posibil sa fie nevoie de update");
            }

            try
            {
                MySqlCommand    cmd    = new MySqlCommand("SELECT * FROM Users WHERE username = '******' ;", conn);
                MySqlDataReader reader = cmd.ExecuteReader();
                reader.Read();

                if (reader.GetString(0) == nume)
                {
                    cateaumers++;
                }
                if (reader.GetString(1) == parola)
                {
                    cateaumers++;
                }
                if (reader.GetString(2) == idpc)
                {
                    cateaumers++;
                }
                Variabile.username = nume;

                if (cateaumers == 3)
                {
                    okflaglogare = true;
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Eroare 164 / Posibil sa fie nevoie de update");
            }

            if (okflaglogare == true)
            {
                Form meniu = new Meniu();
                this.Hide();
                meniu.Show();
            }

            if (okflaglogare == false)
            {
                MessageBox.Show("Eroare 180 : Datele de logare gresite / HWID invalid");
            }
        }