protected void loginBtn_Click(object sender, EventArgs e) { string name = Request["name"]; string pwd = Request["pwd"]; UserDAO userDAO = new UserDAO(); if (userDAO.queryUser(name, pwd)) { Response.Redirect("../Defalut.aspx"); } else { Response.Write("<script>alert(\"用户名或密码错误,请重新登入\")</script>"); } }
/// <summary> /// 创建用户表单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void createUser_Click(object sender, EventArgs e) { User user = new User(); user.Pwd = Request["pwd"]; if (user.Pwd.Equals(Request["pwdAgain"])) { Response.Write("<script>alert(\"两次输入的密码不同,请重新输入\")</script>"); } user.UserName = Request["userName"]; user.MailBox = Request["mailBox"]; user.PhoneNumber = Request["phoneNumber"]; UserDAO userDAO = new UserDAO(); userDAO.insert(user); Response.Write("<script>alert(\"注册成功\")</script>"); Response.Redirect("../Defalut.aspx"); }