protected void Button1_Click(object sender, EventArgs e) { string account = this.TextBox_Account.Text.Trim(); string password = this.TextBox_Password.Text.Trim(); string password1 = this.TextBox_Password1.Text.Trim(); string nickname = this.TextBox_Nickname.Text.Trim(); string city = this.ddlcity.SelectedItem.Text; string area = this.ddlarea.SelectedItem.Text; string address = this.TextBox_Address.Text.Trim(); string email = this.TextBox_Email.Text.Trim(); string phone = this.TextBox_Phone.Text.Trim(); string birthday = ddlBirthday.SelectedItem + "/" + this.Calendar1.SelectedDate.Month.ToString() + "/" + this.Calendar1.SelectedDate.Day.ToString(); string Max = "0"; if (account == "" || password == "" || nickname == "" || address == "" || email == "" || phone == "" || birthday == "") { this.Label_Message.Text = "欄位不可空白"; return; } if (password != password1) { this.Label_Message.Text = "確認密碼不同"; return; } string str = "Select * from 會員基本資料表 where 帳號 ='" + account + "'"; DataTable timeDt = new DataTable(); timeDt = conns.LoadTable_SQL(str, ""); if (timeDt.Rows.Count > 0) { Label_Message.Text = "此帳號已被使用"; return; } string salt = "ABCD"; //原輸入密碼1234加上salt字串,再進行加密動作 password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password + salt, "sha1"); address = city + "," + area + "," + address; string sqlStr = " Insert into 會員基本資料表 values ('" + account + "','" + password + "','" + nickname + "','" + Max + "','" + address + "','" + email + "','" + phone + "','" + birthday + "')"; string rtnMsg; rtnMsg = conns.RunSqlStr(sqlStr, ""); if (rtnMsg == "Success") { this.Label_Message.Text = "申請會員成功"; this.Button_Send.Text = "會員登入"; Response.Redirect("Login.aspx"); } else { this.Label_Message.Text = "申請會員失敗"; } }