コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            scheda_database dbopen = new scheda_database();

            dbopen.Show();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Database pagin = new Database();
            //pagin.Show();
            //this.Hide();
            if (string.IsNullOrEmpty(BoxName.Text) == true || string.IsNullOrEmpty(BoxPass.Text) == true)
            {
                return;
            }
            string user1           = BoxName.Text;
            string pass1           = BoxPass.Text;
            string supersecretpass = "******";

            try
            {
                var conn = new MySqlConnection($"Server=85.10.205.173;port=3306;Uid=ad_pass;Pwd={supersecretpass};Database=passfolder1;Connection Timeout=30;old guids=true;");
                conn.Open();
                var             cmd = new MySqlCommand("select * from Tabelle", conn);
                MySqlDataReader dr  = default;
                dr = cmd.ExecuteReader();
                bool   userfound = false;
                string pass      = default;
                while (dr.Read() == true)
                {
                    if (user1 == dr["Utente"] as string)
                    {
                        userfound = true;
                        pass      = dr["Password"] as string;
                        break;
                    }
                }
                dr.Close();
                dr.Dispose();
                cmd.Dispose();
                if (userfound == false)
                {
                    MessageBox.Show("Utente non trovato");
                }
                else
                {
                    if (Secure.GetHashString(pass1).Equals(pass))
                    {
                        MessageBox.Show("Login Eseguito");
                        if (!File.Exists(@"User\" + user1))
                        {
                            Directory.CreateDirectory(@"User\" + user1);
                        }
                        scheda_database pagin = new scheda_database();
                        currentuser = user1;
                        pagin.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Password non riconosciuta");
                    }
                }
                conn.Close();
            }
            catch
            {
                MessageBox.Show("Login Fallito");
            }
        }
コード例 #3
0
        private void INFO_Leave(object sender, EventArgs e)
        {
            scheda_database pagin = new scheda_database();

            pagin.Show();
        }