using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.OleDb; using System.Web.Services; using System.Data; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void txtName_TextChanged(object sender, EventArgs e) { } protected void Send_Click(object sender, EventArgs e) { //Connect connection = new Connect("/App_Data/Database.accdb"); // string queryString = "INSERT users.[userName], users.[password], users.[email] FROM users"; ////queryString+= string.format("{0}')" //OleDbCommand command = new OleDbCommand(queryString); // connection.TakeAction(command); string name = txtName.Text; string pass = txtPassword.Text; string email = txtEmail.Text; string address = txtAddress.Text; Error1.Text = "You did not fill the following registration fields: "; bool finalcheck = true; if (name == "") { Error1.Visible = true; Error1.Text = Error1.Text + " Name."; finalcheck = false; } if (pass == "") { Error1.Visible = true; Error1.Text = Error1.Text + " Password."; finalcheck = false; } if (email == "") { Error1.Visible = true; Error1.Text = Error1.Text + " Email."; finalcheck = false; } if (address == "") { Error1.Visible = true; Error1.Text = Error1.Text + " Address."; finalcheck = false; } localhost.WebService w = new localhost.WebService(); string check = "SELECT * FROM users WHERE userName = '" + name + "'"; DataTable dt = w.GetConn(check); string check1 = "SELECT * FROM users WHERE email = '" + email + "'"; DataTable dt1 = w.GetConn(check1); if (dt.Rows.Count > 0) { Error2.Text = "This username already exists, please choose a different one"; finalcheck = false; } else { Error2.Text = ""; } if (dt1.Rows.Count > 0) { Error3.Text = "This email already exists, please use a different one"; finalcheck = false; } else { Error3.Text = ""; } if (finalcheck == true) { Error1.Visible = false; string salt = w.RandomString(); string hash = w.getHashSha256(salt + pass); w.Insert(name, hash, email, address, salt); Error3.Text = "You have successfully registered!"; } } }