using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace saytan
{
    public partial class admin1 : Form
    {
        string pass;
        public admin1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == pass)
            {
                adminMain a = new adminMain();
                this.Hide();
                a.ShowDialog();
                this.Close();
            }
            else
            {
                this.Hide();
                this.Close();
            }
        }

        private void admin1_Load(object sender, EventArgs e)
        {
            AcceptButton = button1;
            label1.BackColor = System.Drawing.Color.Transparent;
            textBox1.PasswordChar = '*';
            MySqlConnection n = new MySqlConnection("Server=localhost; database=saytan; UID=root; CHARSET=utf8;");
            n.Open();
            string query = "select pass from admin";
            MySqlCommand cmd = new MySqlCommand(query, n);
            MySqlDataReader reader1 = cmd.ExecuteReader();
            reader1.Read();
            pass = reader1.GetString(0);
            reader1.Close();
        }
    }
}
