Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Button1_Click(object sender, EventArgs e)
- {
- string connString = "Server=****;Port=****;Database=****;Uid=trytokillme;password=****;";
- MySqlConnection conn = new MySqlConnection(connString);
- MySqlCommand username = conn.CreateCommand();
- MySqlCommand password = conn.CreateCommand();
- MySqlCommand checkusername = conn.CreateCommand();
- username.CommandText = "SELECT tool_username FROM phpbb_users WHERE tool_username = '" + TextBox1.Text + "'";
- password.CommandText = "SELECT tool_password FROM phpbb_users WHERE tool_username = '" + TextBox1.Text + "'";
- checkusername.CommandText = "SELECT COUNT(tool_username) FROM phpbb_users Where tool_username ='" + TextBox1.Text + "'";
- try
- {
- conn.Open();
- Int64 check = (Int64)checkusername.ExecuteScalar();
- if (TextBox1.Text == "")
- {
- MessageBox.Show("Enter your username!");
- }
- else if (TextBox2.Text == "")
- {
- MessageBox.Show("Enter your password!");
- }
- else if (check != 0)
- {
- MessageBox.Show("Wrong username or password!");
- }
- else
- {
- try
- {
- MySqlDataReader reader = password.ExecuteReader();
- while (reader.Read())
- {
- if (reader["tool_password"].ToString() == TextBox2.Text)
- {
- MessageBox.Show("You are now logged in. Have fun!");
- }
- else
- {
- MessageBox.Show("Wrong username or password!");
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- conn.Close();
- }
- catch (Exception Fehler)
- {
- MessageBox.Show(Fehler.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement