Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string pass     = textBox2.Text;
            bool   isThere  = false;

            connection.Open();
            SqlCommand    command = new SqlCommand("Select *from Login", connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                if (username == Cryptology.Decryption(reader["username"].ToString().TrimEnd(), 2) && pass == Cryptology.Decryption(reader["pass"].ToString().TrimEnd(), 2))
                {
                    isThere = true;
                    break;
                }

                else
                {
                    isThere = false;
                }
            }

            connection.Close();

            if (isThere)
            {
                MessageBox.Show("successfully logged in", "Program");
            }
            else
            {
                MessageBox.Show("login failed", "program");
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            connection.Open();
            SqlCommand command = new SqlCommand("Insert into Login (username,pass,re_pass,e_mail,phone) values ('" + Cryptology.Encryption(textBox1.Text, 2) + "','" + Cryptology.Encryption(textBox2.Text, 2) + "','" + Cryptology.Encryption(textBox3.Text, 2) + "','" + Cryptology.Encryption(textBox4.Text, 2) + "','" + Cryptology.Encryption(textBox5.Text, 2) + "')", connection);

            command.ExecuteNonQuery();
            connection.Close();
            //MessageBox.Show("!!!", "Program");
            this.Hide();
            Form1 form1 = new Form1();

            form1.Show();
        }