From 25c81aff98ea74abbeafc52435444deb09158f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8F=8B=E6=9E=97?= <2440500528@qq.com> Date: Sun, 5 Jun 2022 16:48:18 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20220606=E7=AC=AC?= =?UTF-8?q?=E5=85=AD=E7=AB=A0=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/.keep" diff --git "a/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/.keep" "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From ab3b1763f6d443623d208017ee7f0ee9bcba752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8F=8B=E6=9E=97?= <2440500528@qq.com> Date: Sun, 5 Jun 2022 16:49:58 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WebForm1.aspx.cs" | 58 ++++ .../WebForm1.aspx.designer.cs" | 80 ++++++ .../WebForm3.aspx.cs" | 59 ++++ .../WebForm3.aspx.designer.cs" | 260 ++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 "04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.designer.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.cs" create mode 100644 "04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.designer.cs" diff --git "a/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.cs" "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.cs" new file mode 100644 index 0000000..e71abbb --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.cs" @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data.SqlClient; +using System.Data; + +namespace Wang08Cookie和添加信息 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; + + + if (!IsPostBack) + { + if (Response.Cookies["name"] != null) + { + txt_Name.Text = Request.Cookies["name"].Value; + } + if (Request.Cookies["pwd"] != null) + { + //txt_Pwd.Text = Request.Cookies["pwd"].Value; + txt_Pwd.Attributes.Add("value", Request.Cookies["pwd"].Value); + } + } + } + protected void Button1_Click(object sender, EventArgs e) + { + RequiredFieldValidator1.Enabled = true; + RequiredFieldValidator2.Enabled = true; + + string name = txt_Name.Text.Trim(); + string pwd = txt_Pwd.Text.Trim(); + + + string sql = $"select * from UserInfo where username = '{name}' and password = '{pwd}' "; + string na = "server = LAPTOP-4E35V3A9; database = UserDB; uid = sa; pwd = @wyl24680 "; + SqlDataAdapter adapter = new SqlDataAdapter(sql, na); + DataTable dt = new DataTable(); + adapter.Fill(dt); + if (dt.Rows.Count > 0 && !string.IsNullOrWhiteSpace(name)) + { + Response.Write(""); + } + else + { + Response.Write(""); + } + + + } + } +} \ No newline at end of file diff --git "a/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.designer.cs" "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.designer.cs" new file mode 100644 index 0000000..f75a98d --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm1.aspx.designer.cs" @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace Wang08Cookie和添加信息 +{ + + + public partial class WebForm1 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_Name 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Name; + + /// + /// RequiredFieldValidator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// txt_Pwd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Pwd; + + /// + /// RequiredFieldValidator2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + } +} diff --git "a/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.cs" "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.cs" new file mode 100644 index 0000000..5ed54bd --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.cs" @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using System.Data.SqlClient; + +namespace Wang08Cookie和添加信息 +{ + public partial class WebForm3 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; + + } + + protected void Button1_Click(object sender, EventArgs e) + { + string sql = $"insert into UserInfo(username, password, sex, email, intro, head_image, roleName, isEnable) values('{txt_name}','{txt_pwd1}','{RadioButtonList1.SelectedValue}','{txt_youxiang}','{txt_jieshao}','{FileUpload1.FileName}','','')"; + + string constr = "server = LAPTOP-4E35V3A9; database = UserDB; uid = sa; pwd = @wyl24680"; + + SqlConnection con = new SqlConnection(constr); + + con.Open(); + SqlCommand command = new SqlCommand(sql, con); + + + int result = command.ExecuteNonQuery(); + if (result>0) + { + Response.Write(""); + } + else + { + Response.Write(""); + } + con.Close(); + Response.Redirect("~/WebForm1.aspx"); + } + + protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) + { + if (RadioButtonList1.SelectedValue== "--自定义--") + { + TextBox4.Enabled = true; + RequiredFieldValidator6.Enabled = true; + } + else + { + TextBox4.Enabled = false; + RequiredFieldValidator6.Enabled = false; + } + } + } +} \ No newline at end of file diff --git "a/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.designer.cs" "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.designer.cs" new file mode 100644 index 0000000..aabd1d2 --- /dev/null +++ "b/04\347\216\213\345\217\213\346\236\227/220606\347\254\254\345\205\255\347\253\240\344\275\234\344\270\232/WebForm3.aspx.designer.cs" @@ -0,0 +1,260 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace Wang08Cookie和添加信息 +{ + + + public partial class WebForm3 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_name 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_name; + + /// + /// RequiredFieldValidator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// txt_pwd1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd1; + + /// + /// RequiredFieldValidator2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; + + /// + /// txt_pwd2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd2; + + /// + /// RequiredFieldValidator3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3; + + /// + /// DropDownList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.DropDownList DropDownList1; + + /// + /// TextBox4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox4; + + /// + /// RequiredFieldValidator6 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator6; + + /// + /// txt_mibao 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_mibao; + + /// + /// txt_youxiang 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_youxiang; + + /// + /// RequiredFieldValidator4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4; + + /// + /// txt_phone 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_phone; + + /// + /// RequiredFieldValidator5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator5; + + /// + /// RadioButtonList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RadioButtonList RadioButtonList1; + + /// + /// DropDownList2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.DropDownList DropDownList2; + + /// + /// CheckBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox1; + + /// + /// CheckBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox2; + + /// + /// CheckBox3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox3; + + /// + /// CheckBox4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox4; + + /// + /// CheckBox5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox5; + + /// + /// CheckBox6 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBox CheckBox6; + + /// + /// FileUpload1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.FileUpload FileUpload1; + + /// + /// txt_jieshao 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_jieshao; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + } +} -- Gitee