Exemple #1
0
        private void user_kayit_Click(object sender, EventArgs e)
        {
            MySqlConnection mysqlbaglan = new MySqlConnection("Server=" + sIp + ";Database=" + sDB + ";Uid=" + sKA + ";Pwd='" + sSifre + "';SslMode=none");

            mysqlbaglan.Open();
            if (user_name.Text.Equals("") || user_password.Text.Equals("") || user_location.Text.Equals("") || user_location.Text.Equals("") || user_age.Text.Equals(""))
            {
                MessageBox.Show("Butun alanlari doldurunuz...");
            }
            else
            {/*
              * string sql = "INSERT INTO `bx-users`(`User-ID`, `Location`, `Age`, `password`, `user_name`) VALUES (null,'" + user_location.Text + "','" + user_age.Text + "','" + user_password.Text + "','" + user_name.Text + "')";
              * MySqlCommand cmd = new MySqlCommand(sql, mysqlbaglan);
              * cmd.ExecuteNonQuery();
              * sql = "SELECT * FROM `bx-users`ORDER BY `bx-users`.`User-ID`  DESC LIMIT 1";
              * cmd = new MySqlCommand(sql, mysqlbaglan);
              * cmd.ExecuteNonQuery();
              * cmd = new MySql.Data.MySqlClient.MySqlCommand(sql, mysqlbaglan);
              * var vR = cmd.ExecuteReader();
              * while (vR.Read())
              * {
              *     tk.newUser = Int32.Parse(vR.GetValue(0).ToString());
              * }*/
                mysqlbaglan.Close();
                SecimEkrani tk = new SecimEkrani();
                tk.deneme      = 1;
                tk.newAge      = user_age.Text;
                tk.newLocation = user_location.Text;
                tk.newName     = user_name.Text;
                tk.newPass     = user_password.Text;
                tk.Show();
                this.Close();
            }
        }
Exemple #2
0
        private void giris_Click(object sender, EventArgs e)
        {
            MySqlConnection mysqlbaglan = new MySqlConnection("Server=" + sIp + ";Database=" + sDB + ";Uid=" + sKA + ";Pwd='" + sSifre + "';SslMode=none");

            mysqlbaglan.Open();
            string       sql = "select* from  `bx-users` where user_name like '" + user_name.Text + "' AND password like '" + user_password.Text + "'";
            MySqlCommand cmd = new MySqlCommand(sql, mysqlbaglan);

            cmd.ExecuteNonQuery();
            cmd = new MySql.Data.MySqlClient.MySqlCommand(sql, mysqlbaglan);
            if (user_name.Text.Equals("admin") && user_password.Text.Equals("password"))
            {
                AdminSayfası aS = new AdminSayfası();
                aS.Show();
                this.Hide();
            }
            else
            {
                var         dr = cmd.ExecuteReader();
                SecimEkrani tk = new SecimEkrani();
                if (dr.HasRows)
                {
                    dr.Close();
                    sql = "SELECT * FROM `bx-users` WHERE `user_name` = \"" + user_name.Text + "\"";
                    MySqlCommand cmd2 = new MySqlCommand(sql, mysqlbaglan);
                    cmd2 = new MySql.Data.MySqlClient.MySqlCommand(sql, mysqlbaglan);
                    var vR = cmd2.ExecuteReader();
                    while (vR.Read())
                    {
                        tk.newUser = Int32.Parse(vR.GetValue(0).ToString());
                    }
                    vR.Close();
                    tk.Show();
                }
                else
                {
                    MessageBox.Show("Lütfen bilgilerinizi kontrol ediniz.");
                }
            }
            mysqlbaglan.Close();
        }