Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 System.Data.SqlClient;
- using MySql.Data.MySqlClient;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- label1.Text = "Vortex Simulations";
- label1.BackColor = Color.Transparent;
- label1.ForeColor = Color.White;
- label2.Text = "Staff Management System";
- label2.BackColor = Color.Transparent;
- label2.ForeColor = Color.White;
- email.BackColor = Color.Transparent;
- email.ForeColor = Color.White;
- email.Text = "Email Address";
- this.FormBorderStyle = FormBorderStyle.FixedSingle;
- password.Text = "Password";
- password.BackColor = Color.Transparent;
- password.ForeColor = Color.White;
- login.Text = "Log In";
- login.BackColor = Color.Purple;
- login.ForeColor = Color.White;
- passwordbox.PasswordChar = '●';
- passwordbox.MaxLength = 24;
- emailbox.MaxLength = 34;
- this.Text = "Vortex Staff Login";
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void emailbox_Click(object sender, EventArgs e)
- {
- if (emailbox.Name == "emailbox")
- {
- }
- }
- private void emailbox_Leave(object sender, EventArgs e)
- {
- if(emailbox.Name == "emailbox")
- {
- }
- }
- private void login_Click(object sender, EventArgs e)
- {
- string connString = "datasource=mailsd.me;username=whenoffi_admin;port=3306;password=redstone2;database=whenoffi_vortexusers;";
- MySqlConnection conn = new MySqlConnection(connString);
- MySqlCommand cmd = new MySqlCommand("SELECT * FROM users WHERE email = '" + emailbox.Text + "' AND password = '" + passwordbox.Text + "'", conn);
- MySqlDataReader dr;
- conn.Open();
- dr = cmd.ExecuteReader();
- int count = 0;
- while (dr.Read())
- {
- count = count + 1;
- }
- if (count == 1)
- {
- this.Hide();
- Form2 form2 = new Form2();
- form2.Closed += (s, args) => this.Close();
- form2.Show();
- MessageBox.Show("OK, " + emailbox.Text);
- }
- else if (count > 1)
- {
- MessageBox.Show("Duplicate email and password");
- }
- else
- {
- MessageBox.Show("Your email or password is not correct");
- }
- conn.Close();
- emailbox.Clear();
- passwordbox.Clear();
- }
- public string emailboxtext
- {
- get { return emailbox.Text; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement