public WebReply btnRegisterSave_Click() { // Save new user record string sql = "Select count(*) as ct from Users where username=@Username"; sql = Sys.PrepareStatement("Register", sql); double x = Sys._data.GetScalarDouble(sql, "ct"); Dialog d = new Dialog(Sys); WebReply wr; if (x > 0) { wr = d.CreateDialog("Error", "User Already Exists", "Sorry, User already exists. Please choose a different username.", 150, 150); return(wr); } if (Sys.GetObjectValue("Register", "Email").Length == 0) { wr = d.CreateDialog("Error", "Email Empty", "Sorry, Email address is Empty. Please choose a different Email.", 150, 150); return(wr); } if (Sys.GetObjectValue("Register", "Password").Length < 4) { wr = d.CreateDialog("Error", "Password does not meet Validation Requirements", "Sorry, Password is not complex enough.", 150, 150); return(wr); } sql = Sys.PrepareStatement("Register", "Select count(*) as ct from Users where Email=@Email"); x = Sys._data.GetScalarDouble(sql, "ct"); if (x > 0) { wr = d.CreateDialog("Error", "Email Already Exists", "Sorry, Email already exists. Please choose a different Email.", 150, 150); return(wr); } if (!Sys.IsValidEmailFormat(Sys.GetObjectValue("Register", "Email"))) { wr = d.CreateDialog("Error", "Invalid E-mail address", "Invalid E-mail address.", 150, 150); return(wr); } string sPrePass = Sys.GetObjectValue("Register", "Password"); if (sPrePass.Contains("'")) { wr = d.CreateDialog("Error", "Password does not meet Validation Requirements", "Sorry, Password contains illegal characters: ', Please remove illegal characters.", 150, 150); return(wr); } string sOrg = "CDE6C938-9030-4BB1-8DFE-37FC20ABE1A0"; sql = "Insert into Users (id,username,password,Email,updated,added,deleted,organization) values (newid(),@Username,'[txtpass]',@Email,getdate(),getdate(),0,'" + sOrg + "')"; sql = Sys.PrepareStatement("Register", sql); sql = sql.Replace("[txtpass]", modCryptography.Des3EncryptData(sPrePass)); Sys._data.Exec(sql); wr = d.CreateDialog("Success", "Successfully Registered", "Successfully Registered", 100, 100); return(wr); }