public void Button1_Click(object sender, EventArgs e) { string name = UNBox.Text.Trim(); string pwd = CreatMd5.GetMD5(PWDBox.Text.Trim()); //传递给业务逻辑层 users Loginuser = new users(); Loginuser.user_name = name; Loginuser.user_password = pwd; string nickname = Loginuser.user_nickname; //UserManage.Login users pu = UserManage.Login(Loginuser); if (pu != null) { if (pu.user_password == pwd) { //Response.Write(string.Format("<script>alert('欢迎您{0}')</script>",nickname)); UserManage.Cook(pu); UserManage.Getmd5cookuid(pu); Response.Redirect(string.Format("index.aspx?uid={0}", pu.user_id)); } else { Response.Write("<script>alert('密码错误');</script>"); } } else { Response.Write("<script>alert('账号不存在,请注册哟。');</script>"); //Response.Redirect(string.Format("reg.aspx?unm={0}",name)); //当账号不存在时,返回name到注册页面 方便用户不用再次输入(加一次验证 询问是否注册) } }
protected void Button1_Click(object sender, EventArgs e) { string uname = unmbox.Text.Trim(); string pwd = CreatMd5.GetMD5(pwdboxy.Text.Trim()); users regu = new users(); regu.user_name = uname; regu.user_password = pwd; if (UserManage.Add(regu) == 1) { Response.Write("<script>alert('注册成功');</script>"); Response.Redirect("index.aspx"); } else { Response.Write("<script>alert('注册shibai');</script>"); } }