diff --git "a/10\344\275\231\351\223\226\351\221\253/.keep" "b/10\344\275\231\351\223\226\351\221\253/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/.keep" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..26bc989ec6536214c3d21bd72bae1ae44d50b831 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.cs" @@ -0,0 +1,57 @@ +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 WebApplication1 +{ + 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 = Response.Cookies["name"].Value; + } + if (Response.Cookies["pwd"] != null) + { + txt_pwd.Text = Response.Cookies["pwd"].Value; + } + } + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = txt_Name.Text.Trim(); + string pwd = txt_pwd.Text.Trim(); + string sql = $"select * from UserInfo where username='{name}' and password='{pwd}'"; + string constr = "Server=LAPTOP-348L9P0D;database=UserDB;uid=sa;pwd=20021217"; + //实例化数据库 + SqlDataAdapter da = new SqlDataAdapter(sql, constr); + //实例化数据表 + DataTable dat = new DataTable(); + da.Fill(dat); + if (dat.Rows.Count > 0) + { + string name1 = dat.Rows[0]["username"].ToString(); + string pwd1 = dat.Rows[0]["password"].ToString(); + Response.Redirect("~/lts.aspx"); + } + else + { + Response.Write(""); + } + } + + protected void Button2_Click(object sender, EventArgs e) + { + Response.Redirect("~/index.aspx"); + } + } +} \ No newline at end of file diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.designer.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..1416cd1bc5df3171c82cf6f2d8e67ad19ef89858 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/WebForm1.aspx.designer.cs" @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class WebForm1 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_Name 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_Name; + + /// + /// txt_pwd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + } +} diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..2129e1f0f86062a582133727bb02936239a42c44 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.cs" @@ -0,0 +1,52 @@ +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 WebApplication1 +{ + public partial class index : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; + } + protected void Button1_Click(object sender, EventArgs e) + { + string name = txt_name.Text; + string pwd = txt_pwd.Text; + string pwd1 = txt_pwd1.Text; + string EncryptedIssue = TextBox4.Text; + string Encrypted = TextBox5.Text; + string mail = txt_mail.Text; + string phone = txt_phone.Text; + string gender = txt_Gender.Text; + string major = DropDownList2.Text; + string hobby = CheckBoxList1.Text; + string self = TextBox8.Text; + string sql = $"insert InFor values('{name}','{pwd}','{pwd1}','{EncryptedIssue}','{Encrypted}','{mail}','{phone}','{gender}','{major}','{hobby}','{self}')"; + string constr = "server=LAPTOP-348L9P0D;database=register;uid=sa;pwd=20021217;"; + SqlConnection con = new SqlConnection(constr); + SqlCommand command = new SqlCommand(sql, con); + con.Open(); + int a10 = command.ExecuteNonQuery(); + con.Close(); + if (a10 > 0) + { + Response.Write("添加成功!"); + } + else + { + Response.Write("添加失败!"); + } + } + + protected void Button2_Click(object sender, EventArgs e) + { + Response.Redirect("~/WebForm1.aspx"); + } + } +} \ No newline at end of file diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.designer.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..8a6535b8267aa1cb40fcf98abba1b6efaec78701 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/index.aspx.designer.cs" @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class index + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// txt_name 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_name; + + /// + /// CustomValidator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CustomValidator CustomValidator1; + + /// + /// txt_pwd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd; + + /// + /// CustomValidator2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CustomValidator CustomValidator2; + + /// + /// txt_pwd1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_pwd1; + + /// + /// CustomValidator3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CustomValidator CustomValidator3; + + /// + /// DropDownList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.DropDownList DropDownList1; + + /// + /// TextBox4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox4; + + /// + /// TextBox5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox5; + + /// + /// txt_mail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_mail; + + /// + /// txt_phone 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txt_phone; + + /// + /// txt_Gender 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.RadioButtonList txt_Gender; + + /// + /// DropDownList2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.DropDownList DropDownList2; + + /// + /// CheckBoxList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.CheckBoxList CheckBoxList1; + + /// + /// FileUpload1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.FileUpload FileUpload1; + + /// + /// TextBox8 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox8; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + } +} diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..192ce3da72ccb22d2ed44e7c70292262992c0c33 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.cs" @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class lts : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack && Session["name"] != null) + { + Label1.Text = Session["name"].ToString(); + } + if (Session["name"] == null) + { + Response.Redirect("~/index.aspx"); + } + } + protected void Button1_Click(object sender, EventArgs e) + { + string time = DateTime.Now.ToString(); + string name = Session["name"].ToString(); + string message = TextBox2.Text; + string sum = time + ": " + name + ": " + message; + Application["message"] += sum.ToString(); + TextBox1.Text = Application["message"].ToString(); + } + + protected void Button2_Click(object sender, EventArgs e) + { + TextBox1.Text = Application["message"].ToString(); + } + protected void Button3_Click(object sender, EventArgs e) + { + Session.Abandon(); + Response.Redirect("login.aspx"); + + } + } +} \ No newline at end of file diff --git "a/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.designer.cs" "b/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..6a71fd3116f1f1c34ba105a8c3b10a097e033711 --- /dev/null +++ "b/10\344\275\231\351\223\226\351\221\253/22-6-4/lts.aspx.designer.cs" @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class lts + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// TextBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// TextBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + + /// + /// Button3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button3; + } +}