protected void btn_register_Click(object sender, EventArgs e) { txtGName = Request.Form["txtgname"]; gPassword = Request.Form["gpassword"]; txtPhone = Request.Form["txtphone"]; txtQQ = Request.Form["txtqq"]; ManageUser mUser = new ManageUser(txtGName, gPassword, txtPhone, txtQQ); CManageUser insertUser = new CManageUser(); if (insertUser.Insert(mUser)) { this.ltErrInfo.Text = "<script>alert('注册成功!');</script>"; } else { this.ltErrInfo.Text = "<script>alert('注册失败!');</script>"; } Response.Redirect("login.aspx"); }
protected void btn_login_Click(object sender, EventArgs e) { string userName = Request.Form["manusername"]; string password = Request.Form["gpassword"]; CManageUser queryUser = new CManageUser(); string result = queryUser.Query(userName); if (result != null) {//该用户名存在 if (result == Request.Form["gpassword"]) { this.ltErrInfo.Text = "登陆成功"; Response.Redirect("../index.aspx"); } else { this.ltErrInfo.Text = "<script>alert('密码错误');</script>"; } } else { this.ltErrInfo.Text = "<script>alert('用户名错误');</script>"; } }