protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("user_edit", "编辑会员")) { WindowNoPower(); } id = RequestTool.RequestInt("id", 0); user_questions = B_Lebi_User_Question.GetList("", "Sort desc"); where = "User_id=" + id + ""; user_answers = B_Lebi_User_Answer.GetList(where, "id asc", 20, 1); recordCount = B_Lebi_User_Answer.Counts(where); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { if (CurrentUser.id == 0) { Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + "")); } LoadTheme(themecode, siteid, languagecode, pcode); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_UserQuestion'"); type = Rint_Para("0"); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>»</em><a class=\"text\"><span>" + Tag("安全问题") + "</span></a>"; user_questions = B_Lebi_User_Question.GetList("", "Sort desc"); where = "User_id=" + CurrentUser.id + ""; user_answers = B_Lebi_User_Answer.GetList(where, "id asc", 20, 1); recordCount = B_Lebi_User_Answer.Counts(where); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { id = RequestTool.RequestInt("id", 0); v = RequestTool.RequestString("v"); type = RequestTool.RequestInt("type", 0); LoadTheme(themecode, siteid, languagecode, pcode); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("Ê×Ò³") + "\"><span>" + Tag("Ê×Ò³") + "</span></a><em class=\"home\">»</em><a class=\"text\"><span>" + Tag("Íü¼ÇÃÜÂë") + "</span></a>"; Lebi_User user = B_Lebi_User.GetModel("id=" + id + " and CheckCode = lbsql{'" + v + "'}"); if (user == null) { id = 0; type = 0; } user_answers = B_Lebi_User_Answer.GetList("User_id=" + id + "", "id asc", 20, 1); if (user_answers.Count == 0) { id = 0; type = 0; } EX_User.CheckForgetPWD(CurrentTheme, CurrentLanguage, type); }
/// <summary> /// 编辑安全问题 /// </summary> public void Question_Edit() { int type = RequestTool.RequestInt("type", 0); int Question_id1 = RequestTool.RequestInt("Question_id1", 0); int Question_id2 = RequestTool.RequestInt("Question_id2", 0); string Answer1 = EX_User.MD5(RequestTool.RequestSafeString("Answer1")); string Answer2 = EX_User.MD5(RequestTool.RequestSafeString("Answer2")); if (Question_id1 == Question_id2) { Response.Write("{\"msg\":\"" + Tag("请选择两个不同的问题") + "\"}"); return; } if (Answer1 == "" || Answer2 == "") { Response.Write("{\"msg\":\"" + Tag("请填写问题答案") + "\"}"); return; } bool addflag = false; Lebi_User_Answer model = B_Lebi_User_Answer.GetModel("User_id = " + CurrentUser.id + ""); if (model == null) { addflag = true; model = new Lebi_User_Answer(); } if (addflag) { model.User_Question_id = Question_id1; model.Answer = Answer1; model.User_id = CurrentUser.id; B_Lebi_User_Answer.Add(model); model.User_Question_id = Question_id2; model.Answer = Answer2; model.User_id = CurrentUser.id; B_Lebi_User_Answer.Add(model); } else { int i = 0; List <Lebi_User_Answer> modellists = B_Lebi_User_Answer.GetList("User_id = " + CurrentUser.id + "", "id asc"); foreach (Lebi_User_Answer modellist in modellists) { if (i == 0 && modellist.Answer != Answer1) { Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}"); return; } if (i == 1 && modellist.Answer != Answer2) { Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}"); return; } i++; } if (type == 1) { CurrentUser.Pay_Password = ""; B_Lebi_User.Update(CurrentUser); Response.Write("{\"msg\":\"OK\",\"type\":\"1\",\"url\":\"" + URL("P_UserChangePassword", "") + "\"}"); return; } else { B_Lebi_User_Answer.Delete("User_id = " + CurrentUser.id + ""); } } Response.Write("{\"msg\":\"OK\",\"type\":\"0\"}"); }
/// <summary> /// 重置密码 /// </summary> public void User_resetpwd() { int type = RequestTool.RequestInt("type", 0); string checkcode = RequestTool.RequestString("checkcode"); string email = RequestTool.RequestSafeString("email"); string PWD = RequestTool.RequestSafeString("PWD"); string RPWD = RequestTool.RequestSafeString("RPWD"); string v = RequestTool.RequestSafeString("v"); int id = RequestTool.RequestInt("id", 0); string Answer1 = EX_User.MD5(RequestTool.RequestSafeString("Answer1")); string Answer2 = EX_User.MD5(RequestTool.RequestSafeString("Answer2")); Lebi_User user = B_Lebi_User.GetModel("id=" + id + " and CheckCode = lbsql{'" + v + "'}"); bool flag = true; if (user == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (type == 0 && user != null) { if (user.CheckCode != checkcode) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } } if (type == 1) { int i = 0; List <Lebi_User_Answer> modellists = B_Lebi_User_Answer.GetList("User_id = " + id + "", "id asc"); if (modellists.Count == 0) { Response.Write("{\"msg\":\"" + Tag("没有设置安全问题") + "\"}"); return; } foreach (Lebi_User_Answer modellist in modellists) { if (i == 0 && modellist.Answer != Answer1) { Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}"); return; } if (i == 1 && modellist.Answer != Answer2) { Response.Write("{\"msg\":\"" + Tag("问题答案回答不正确") + "\"}"); return; } i++; } } if (PWD == "") { Response.Write("{\"msg\":\"" + Tag("密码不能为空") + "\"}"); return; } if (PWD != RPWD) { Response.Write("{\"msg\":\"" + Tag("两次输入的密码不一致,请检查") + "\"}"); return; } user.Password = EX_User.MD5(PWD); user.CheckCode = ""; B_Lebi_User.Update(user); Response.Write("{\"msg\":\"OK\"}"); }