protected void Page_Load(object sender, EventArgs e) { //long iUserID = Convert.ToInt64(Request["UserID"]); if (!IsPostBack) { //validatedCode v = new validatedCode(); //string code = v.CreateVerifyCode(); ////ImgCheck.ImageUrl = code; //v.CreateImageOnPage(code, this.Context); //Session["CheckCode"] = code; string host = Request.Url.Host; if (Request["name"] != null) { //登录另一个域名 string UserName = Request.QueryString["name"]; lgk.Model.tb_user uModel = userBLL.GetModel(GetUserID(UserName)); if (uModel.Password != PageValidate.GetMd5(Request.QueryString["pwd"])) { return;//密码不对 } UserUtil.Login(UserName, "A128076_user", false); //放入cookie HttpCookie UserCookie = new HttpCookie("A128076_user"); if (Request["id"] == null) { UserCookie["Id"] = GetUserID(UserName).ToString(); } else { UserCookie["Id"] = Request.QueryString["id"]; } UserCookie["name"] = UserName; Response.AppendCookie(UserCookie); HttpCookie CultureCookie = new HttpCookie("Culture"); CultureCookie.Value = Request.QueryString["lan"]; //CultureCookie.Value = "zh-cn"; Response.AppendCookie(CultureCookie); //Response.Redirect("/HTMLPage1.htm"); //Response.Redirect("http://" + host.Replace("www.", "vip.") + "/user/index.aspx");//跳转到会员中心 Response.Redirect("/user/index.aspx"); } // if (host.IndexOf("www.") == 0) // { //// //Response.Redirect("/HTMLPage1.htm"); //// //Response.Redirect("http://" + host + "/user/shop/index.aspx");//用www访问跳转到商城 // Response.Redirect("/user/shop/index.aspx"); // } //if (string.IsNullOrEmpty(Request["adminid"]) == false) //{ // Security sec = new Security();//解密传递过来的参数 // string admin = sec.DecryptQueryString(Request["adminid"].ToString());//Request["adminid"].ToString();// // long userid = Convert.ToInt32(sec.DecryptQueryString(Request["uid"].ToString()));//Request["adminid"].ToString();// // RegexR reg = new RegexR(); // if(reg.Nums(admin) == true) // { // AdminEnter(admin, userid); // } // else // { // bindLogin(); // } //} //if (Request.Cookies["Culture"] == null || Request.Cookies["Culture"].Value.ToString() == "zh-cn") //{ // this.rdoZH.Checked = true; //} //else //{ // this.rdoEn.Checked = true; //} } }
/// <summary> /// 输入验证 /// </summary> /// <returns></returns> protected bool RegValidate() { lgk.Model.tb_user recommendInfo = new lgk.Model.tb_user(); //lgk.Model.tb_user parentInfo = new lgk.Model.tb_user(); //lgk.Model.tb_agent agentInfo = new lgk.Model.tb_agent(); #region 会员编号验证 if (txtUserCode.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("PleaseNumber"), Library.Enums.ModalTypes.warning);//请输入会员编号 return(false); } //if (!PageValidate.checkUserCode(txtUserCode.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("MemberNumber") + "');", true);//会员编号必须由6-10位的英文字母或数字组成 // return false; //} if (AC.GetUserID(txtUserCode.Value.Trim()) > 0) { MessageBox.ShowBox(this.Page, AC.GetLanguage("Memberexists"), Library.Enums.ModalTypes.info);//该会员编号已存在,请重新输入! return(false); } #endregion if (txtNiceName.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("Nickname"), Library.Enums.ModalTypes.warning);//会员昵称不能为空 return(false); } #region 密码验证 if (txtPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("PasswordISNull"), Library.Enums.ModalTypes.warning);//登录密码不能为空 return(false); } //if (txtPassword.Value.Trim().Length < 6) //{ // MessageBox.ShowBox(this.Page, GetLanguage("PasswordLength"), Library.Enums.ModalTypes.warning);//密码长度不能小于6位 // return false; //} if (txtRegPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("ConfirmPasswordISNull"), Library.Enums.ModalTypes.warning);//确认密码不能为空 return(false); } if (!txtPassword.Value.Trim().Equals(txtRegPassword.Value.Trim())) { MessageBox.ShowBox(this.Page, AC.GetLanguage("TwoPasswordMatch"), Library.Enums.ModalTypes.warning);//两次输入的登录密码不一致 return(false); } if (txtSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return(false); } if (txtRegSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("secondaryPasswordISNull"), Library.Enums.ModalTypes.warning);//确认二级密码不能为空 return(false); } if (!txtSecondPassword.Value.Trim().Equals(txtRegSecondPassword.Value.Trim())) { MessageBox.ShowBox(this.Page, AC.GetLanguage("TwoSecondaryMatch"), Library.Enums.ModalTypes.warning);//两次输入的二级密码不一致 return(false); } #endregion #region 银行验证 //string strBankAccount = this.txtBankAccount.Value.Trim(); //if (txtAlipay.Value.Trim() == "" && string.IsNullOrEmpty(strBankAccount)) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("AlipayAccount") + "');", true);//支付宝账号不能为空 // return false; //} //if (!string.IsNullOrEmpty(strBankAccount) && !PageValidate.RegexTrueBank(this.txtBankAccount.Value) && string.IsNullOrEmpty(txtAlipay.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("BankCardErrors") + "');", true);//银行卡号输入错误 // return false; //} //string strBankAccountUser = this.txtBankAccountUser.Value.Trim(); //if (!string.IsNullOrEmpty(strBankAccountUser) && !PageValidate.RegexTrueName(txtBankAccountUser.Value.Trim()) && string.IsNullOrEmpty(txtAlipay.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("NameMust") + "');", true);//开户名必须为2-30个中英文 // return false; //} #endregion #region 推荐人验证 string reName = this.txtRecommendCode.Value.Trim(); if (string.IsNullOrEmpty(reName)) { MessageBox.ShowBox(this.Page, AC.GetLanguage("ReferenceNumberIsnull"), Library.Enums.ModalTypes.warning);//推荐人编号不能为空 return(false); } else { recommendInfo = AC.userBLL.GetModel(AC.GetUserID(reName));//推薦用户 if (recommendInfo == null) { MessageBox.ShowBox(this.Page, AC.GetLanguage("featuredNotExist"), Library.Enums.ModalTypes.warning);//该推荐会员不存在 return(false); } if (recommendInfo.IsOpend == 0) { MessageBox.ShowBox(this.Page, AC.GetLanguage("MemberISNull"), Library.Enums.ModalTypes.warning);//该会员尚未开通,不能作为推荐会员 return(false); } } #endregion //if (radioRegQy.SelectedValue == "") //{ // MessageBox.ShowBox(this.Page, "请选择注册区域", Library.Enums.ModalTypes.warning);//会员昵称不能为空 // return false; //} #region 手机号码验证 var strPhoneNum = this.txtUserCode.Value.Trim(); AllCore ac = new AllCore(); if (!string.IsNullOrEmpty(strPhoneNum) && !PageValidate.RegexPhone(strPhoneNum)) { MessageBox.ShowBox(this.Page, ac.GetLanguage("PhoneMust"), Library.Enums.ModalTypes.error);//联系电话格式错误 return(false); } int userid = ac.GetUserIDbByPhone(strPhoneNum); if (userid > 0) { MessageBox.ShowBox(this.Page, ac.GetLanguage("PhoneRegExists"), Library.Enums.ModalTypes.info);//该手机号码已注册 return(false); } int ct = ac.GetPhoneNumber(strPhoneNum); // int p_phoneNumer = getParamInt("RegisterPhoneNumber"); if (ct >= 1) { MessageBox.ShowBox(this.Page, string.Format(ac.GetLanguage("RegisterPhoneNumber")), Library.Enums.ModalTypes.warning);//该手机号码已注册 return(false); } if (txtIDNumber.Value.Trim().Length < 15 && txtIDNumber.Value.Trim().Length > 18) { MessageBox.ShowBox(this.Page, string.Format("请输入正确的身份证号码!"), Library.Enums.ModalTypes.warning);//请输入正确的身份证号码 return(false); } ct = ac.GetIDCodeNumber(txtIDNumber.Value.Trim()); if (ct >= 1) { MessageBox.ShowBox(this.Page, string.Format(ac.GetLanguage("RegisterIDCodeNumber")), Library.Enums.ModalTypes.warning);//该身份证号注册 return(false); } var agentcode = Agent.Value.Trim(); int ID = ac.agentBLL.GetAgentsIDByUserCode(agentcode); if (ID == 0) //服务中心 { MessageBox.ShowBox(this.Page, string.Format("该服务中心不存在!"), Library.Enums.ModalTypes.warning); //请输入正确的身份证号码 return(false); } if (ac.agentBLL.GetModel(ID).Flag == 2) { MessageBox.ShowBox(this.Page, string.Format("该服务中心已被冻结!"), Library.Enums.ModalTypes.warning);//请输入正确的身份证号码 return(false); } #endregion #region 密保问题验证 //if (dropQuestion.SelectedValue.Trim() == "0") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseSelectQuestion") + "');", true);//请选择密保问题 // return false; //} //if (string.IsNullOrEmpty(txtAnswer.Text)) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseAnswer") + "');", true);//请输入密保答案 // return false; //} #endregion #region 商务中心 //int iAgentOpend = getParamInt("AgentSwith");//商务中心是否开启 //if (!string.IsNullOrEmpty(txtAgent.Value.Trim())) //{ // if (iAgentOpend == 1) // { // bool isagent = agentBLL.isExistByName(txtAgent.Value.Trim()); // if (!isagent) // { // MessageBox.ShowBox(this.Page, GetLanguage("AgentNumberExist"), Library.Enums.ModalTypes.warning);//商务中心编号不存在 // return false; // } // } //} //decimal regopen = getParamAmount("RegOpen"); //if(LoginUser.Emoney < regopen) //{ // MessageBox.ShowBox(this.Page, GetLanguage("RegOpenMust"), Library.Enums.ModalTypes.warning);//注册积分不足 // return false; //} #endregion return(true); }
protected void btnLogin_Click(object sender, EventArgs e) { if (setBLL.GetModel(1).IsOpenWeb == 0) { MessageBox.ShowAndRedirect(this, setBLL.GetModel(1).CloseWebRemark, "login.aspx"); } else { if (this.Phone.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseNmae") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("PleaseNmae"), Library.Enums.ModalTypes.warning);//请输入用户名 //return; } //if (this.TBUserName.Value.Trim() == "用户名") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请输入用户名!');", true); // return; //} //if (this.TBPassWord.Value.Trim() == "密码") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请输入密码!');", true); // return; //} if (this.TBCode.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Verification") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("Verification"), Library.Enums.ModalTypes.warning);//验证码不能为空 //return; } string xd = Session["CheckCode"] != null && Session["CheckCode"].ToString() != "" ? Session["CheckCode"].ToString() : ""; if (xd.ToLower() != TBCode.Value.Trim().ToLower()) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("VerificationError") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("VerificationError"), Library.Enums.ModalTypes.error);//验证码错误 //return; } lgk.Model.tb_user user = userBLL.GetModel(GetUserID(Phone.Value.Trim())); if (user == null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("AccountError") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("AccountError"), Library.Enums.ModalTypes.error);//账号或密码错误 //return; } if (Text2.Value.Trim() != "") { string regSwitch = ConfigurationManager.AppSettings["SMS_SWITCH"];//注册短信开关 if (regSwitch.Equals("Open")) { if (CheckSMSCode(this.Phone.Value.Trim(), Text2.Value.Trim().ToString(), 2) < 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('短信验证码错误');", true); return; //MessageBox.ShowBox(this.Page,"短信验证码错误", Library.Enums.ModalTypes.error);//账号或密码错误 //return; } } } else { if (this.TBPassWord.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseEnter") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("PleaseEnter"), Library.Enums.ModalTypes.warning);//请输入密码 //return; } if (user.Password != PageValidate.GetMd5(TBPassWord.Value)) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("AccountError") + "');", true); return; //MessageBox.ShowBox(this.Page, GetLanguage("AccountError"), Library.Enums.ModalTypes.error);//账号或密码错误 //return; } } //if (user.IsOpend == 4 || user.IsLock == 1) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('账号已冻结不能登录!');", true); // return; //} //if (user.IsOpend == 0 || user.IsOpend == 4 || user.IsLock == 1) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('账号未开通或已冻结不能登录!');", true); // return; //} string UserName = this.Phone.Value.Trim(); UserUtil.Login(UserName, "A128076_user", false); //放入cookie HttpCookie UserCookie = new HttpCookie("A128076_user"); UserCookie["Id"] = user.UserID.ToString(); UserCookie["name"] = UserName; Response.AppendCookie(UserCookie); //HttpCookie CultureCookie = new HttpCookie("Culture"); //CultureCookie.Value = "zh-cn";//中文 //Response.AppendCookie(CultureCookie); HttpCookie Culture; if (HttpContext.Current.Request.Cookies["Culture"] == null) { Culture = new HttpCookie("Culture"); } else { Culture = HttpContext.Current.Request.Cookies["Culture"]; } if (LangType.Value != "2") { Culture.Value = "zh-cn";//中文 } else { Culture.Value = "en-us";//英文 } Response.AppendCookie(Culture); //登录系统 Response.Redirect("/user/index.aspx"); } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { if (RegValidate()) { string phone = txtUserCode.Value.Trim().ToString(); //if (CheckSMSCode(phone, txtVerifCode.Value.Trim().ToString(), 1) < 0)//验证短信验证码 //{ // MessageBox.ShowBox(this.Page, "", GetLanguage("SMSVerificationError"), Library.Enums.ModalTypes.warning);//注册失败,该会员编号已存在,请重新注册! // return; //} lgk.Model.tb_user userInfo = new lgk.Model.tb_user(); lgk.Model.tb_user recommendInfo = AC.userBLL.GetModel(AC.GetUserID(this.txtRecommendCode.Value.Trim()));//推荐用户 //lgk.Model.tb_user parentInfo = userBLL.GetModel(GetUserID(this.txtParentCode.Value.Trim()));//父节点用户 //lgk.Model.tb_user agentInfo = userBLL.GetModel(GetUserID(txtAgentCode.Value.Trim()));//报单会员 userInfo.UserCode = txtUserCode.Value.Trim(); //会员编号 userInfo.LevelID = 1; userInfo.RecommendID = recommendInfo.UserID; //推荐人ID userInfo.RecommendCode = recommendInfo.UserCode; userInfo.RecommendPath = recommendInfo.RecommendPath; //路径 userInfo.RecommendGenera = Convert.ToInt32(recommendInfo.RecommendGenera + 1); //(推荐代数)第几代 userInfo.LeftBalance = 0; userInfo.LeftNewScore = 0; userInfo.RightBalance = 0; userInfo.RightNewScore = 0; userInfo.LeftScore = 0; userInfo.RightScore = 0; userInfo.User007 = ""; //m_user.Location == 1 ? "左区" : "右区"; userInfo.IsOpend = 0; //是否启用 0-未激活,1-新注册, 2-已激活 userInfo.IsLock = 0; //是否被冻結(0-否,1-冻結) userInfo.IsAgent = 0; //是否报單中心(0-否,1-是) //string a = Luodian(); //if (a == "") //{ // MessageBox.ShowBox(this.Page, "", "落点失败!", Library.Enums.ModalTypes.error);//注册失败 // return; //} //string[] ID = a.Split('-'); //var model_1 = userBLL.GetModel(long.Parse(ID[0])); userInfo.ParentID = 0; //父节点ID userInfo.ParentCode = ""; //父节点編號 userInfo.UserPath = ""; //路径 userInfo.Layer = 0; //属于多少层 userInfo.Emoney = 0; //报单积分 userInfo.BonusAccount = 0; //拆分积分 userInfo.AllBonusAccount = 0; //量子宝 userInfo.StockAccount = 0; //云积分 userInfo.StockMoney = 0; //公积金 userInfo.GLmoney = 0; //复投积分 decimal dRegMoney = 0; userInfo.ShopAccount = 0; //奖金币 userInfo.RegMoney = dRegMoney; userInfo.BillCount = 1;// getParamInt("reg" + ddlLevel.SelectedValue);//注册单数 userInfo.Location = 0; //区域 userInfo.RegTime = DateTime.Now; //注册時間 userInfo.Password = PageValidate.GetMd5(this.txtPassword.Value.Trim()); //一级密码 userInfo.SecondPassword = PageValidate.GetMd5(this.txtSecondPassword.Value.Trim()); //二级密码 userInfo.ThreePassword = PageValidate.GetMd5(Util.CreateNo()); userInfo.NiceName = txtNiceName.Value.Trim(); userInfo.TrueName = ""; // "姓名"; userInfo.IdenCode = txtIDNumber.Value; // "身份证號"; string strPhoneNum = this.txtUserCode.Value.Trim(); userInfo.PhoneNum = string.IsNullOrEmpty(strPhoneNum) ? "" : strPhoneNum; // "手机號碼"; userInfo.Address = ""; //聯系地址 userInfo.NiceName = string.Empty; //txtNickName.Value.Trim();//昵称 userInfo.TrueName = string.Empty; // "姓名"; string phoneNum = this.txtPhoneNum.Value.Trim(); userInfo.PhoneNum = string.IsNullOrEmpty(phoneNum) ? "" : phoneNum; // "手机號碼"; userInfo.Address = string.Empty; //聯系地址 userInfo.QQnumer = ""; //QQ userInfo.Email = ""; //电子邮箱 userInfo.User001 = 0; userInfo.User004 = 0; userInfo.User002 = 1; // userInfo.User003 = 0; // userInfo.Location = 0; /*radMarketOne.Checked == true ? 1 : 2*/ userInfo.User007 = ""; userInfo.User006 = Agent.Value.Trim(); //int.TryParse(dropQuestion.SelectedValue, out q); //string question = q > 0 && q <= 3 ? dropQuestion.SelectedItem.Text : string.Empty; userInfo.User009 = ""; // question;//密保问题 userInfo.User010 = ""; // string.IsNullOrEmpty(question) ? string.Empty : txtAnswer.Text.Trim();//密保答案 userInfo.User011 = 0; userInfo.User015 = 0; //购股币 userInfo.User016 = 0; userInfo.User017 = 0; userInfo.User018 = 0;//--用户竞拍该扣未扣的奖金币 //userInfo.User007 = Util.GetUniqueIndentifier(20); //userInfo.User008 = Util.GetUniqueIndentifier(4).ToUpper();//邀请码 //userInfo.User010 = "";// txtAlipay.Value.Trim(); //支付宝 long iUID = AC.GetUserID(txtUserCode.Value.Trim()); if (iUID > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "hideloading", "hideloading();", true); MessageBox.ShowBox(this.Page, AC.GetLanguage("RegistrationFails"), Library.Enums.ModalTypes.error);//注册失败,该会员编号已存在,请重新注册! } else { if (AC.userBLL.Add(userInfo) > 0) { lgk.Model.tb_user model = AC.userBLL.GetModel(AC.GetUserID(userInfo.UserCode)); //model.UserPath = model.UserPath + "-" + model.UserID.ToString(); model.RecommendPath = model.RecommendPath + "-" + model.UserID.ToString(); model.RegMoney = 0; model.LeftScore = 0; model.RightScore = 0; model.RightNewScore = 0; model.LeftNewScore = 0; AC.userBLL.Update(model); //写流水 MessageBox.ShowBox(this.Page, "", "注册成功!", Library.Enums.ModalTypes.success);//注册成功 return; } else { lgk.Model.tb_user model = AC.userBLL.GetModel(AC.GetUserID(userInfo.UserCode)); AC.userBLL.Delete(model.UserID);//删除该会员资料 ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('异常错误,注册失败!');", true); return; } // string msg = userBLL.proc_RegisterUser(userInfo); //if (msg == "ok") //{ // long userid = GetUserID(userInfo.UserCode); // int statusCode; // var api = new EaseMobAPIHelper(); // if (System.Configuration.ConfigurationManager.AppSettings["ACCOUNTSYNC_SWITCH"] != "Open") // { // var data = api.AccountCreate(userInfo.UserCode, userInfo.ThreePassword, out statusCode); // if (statusCode == 200) // { // var emResult = JsonConvert.DeserializeObject<APPService.EaseMobResult>(data); // if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null) // { // MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);//注册成功 // return; // } // else // { // userBLL.Delete(userid); // MessageBox.ShowBox(this.Page, "", "网络繁忙,注册失败.", Library.Enums.ModalTypes.error);//注册失败 // } // } // else // { // userBLL.Delete(userid); // LogHelper.SaveLog(data, "LinkRegister"); // MessageBox.ShowBox(this.Page, "", "网络繁忙,请稍后重试", Library.Enums.ModalTypes.error);//注册失败 // } // } // else // { // MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);//注册成功 // return; // } //} //else //{ // MessageBox.ShowBox(this.Page, "", msg, Library.Enums.ModalTypes.error);//注册失败 //} } } }
protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "hideloading", "function hideloading() { ajaxbg.hide(); }", true); if (Request["UserID"] != null && Request["UserID"].Length > 0) { if (PageValidate.IsLong(Request["UserID"])) { iUserID = Convert.ToInt64(Request["UserID"].ToString()); } } else { iUserID = 0; } SetCountDownBtn(); if (!IsPostBack) { //BindBank(); //BindQuestion(); //BindProvince(); if (iUserID == 0) { iUserID = GetLoginID(); } string state = AC.getStringRequest("state"); int a0 = 0, a1 = -1, a2 = 0; if (state != null && state != "") { string[] a = state.Split(','); int.TryParse(a[0].Trim(), out a0); if (a.Length >= 2) { int.TryParse(a[1].Trim(), out a1); } if (a.Length >= 3) { int.TryParse(a[2].Trim(), out a2); } } else { var userInfo = AC.userBLL.GetModel(iUserID); string strUserCode = userInfo != null ? userInfo.UserCode : ""; txtRecommendCode.Value = strUserCode; //if (userInfo != null) //{ // if (userInfo.IsAgent == 1 && agentBLL.GetIDByIDUser(getLoginID(),1) > 0) // { // txtAgentCode.Value = strUserCode; // } // else // { // txtAgentCode.Value = agentBLL.GetModel(userInfo.AgentsID).AgentCode; // } //} } btnCreateUser.Text = AC.GetLanguage("Build"); //生成编号 btnValidate.Text = AC.GetLanguage("detection"); //检测编号 btnSubmit.Text = AC.GetLanguage("Submit"); //提交 } }
protected void btnLogin_Click(object sender, EventArgs e) { if (this.txtUserName.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请输入用户名!');", true); //MessageBox.Show(this, "请输入用户名!"); return; } if (this.txtUserName.Value.Trim() == "用户名") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请输入用户名!');", true); //MessageBox.Show(this, "请输入用户名!"); return; } if (this.txtPwd.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请输入密码!');", true); //MessageBox.Show(this, "请输入密码!"); return; } if (this.txtVa.Value.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('验证码不能为空!');", true); return; } if (this.txtVa.Value.Trim().ToLower() != Session["CheckCode"].ToString().ToLower()) { WriteDBLog("验证码错误:" + this.txtVa.Value, 1); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('验证码错误!');", true); return; } if (!ExistsAdmin(txtUserName.Value.Trim(), PageValidate.GetMd5(txtPwd.Value.Trim()))) { WriteDBLog("账号或密码错误:" + txtPwd.Value, 1); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('账号或密码错误!');", true); //MessageBox.Show(this, "账号或密码错误"); return; } WriteDBLog("登录成功", 0); //string xd = Session["CheckCode"] != null && Session["CheckCode"].ToString() != "" ? Session["CheckCode"].ToString() : ""; //if (xd.ToLower() != txtfield.Text.ToLower()) //{ // MessageBox.Show(this, "验证码错误"); // return; //} lgk.Model.tb_admin admin = adminBLL.GetModel(txtUserName.Value.Trim()); //if (admin.Limits == null) //{ // MessageBox.Show(this, "您的权限不足,请联系超级管理员"); // return; //} UserUtil.Login(this.txtUserName.Value.Trim(), "A128076_admin", false); //放入cookie HttpCookie UserCookie = new HttpCookie("A128076_admin"); DataSet ds = GetAdminModel(txtUserName.Value, PageValidate.GetMd5(txtPwd.Value)); UserCookie["Id"] = ds.Tables[0].Rows[0]["ID"].ToString(); UserCookie["name"] = Convert.ToString(txtUserName.Value); Response.AppendCookie(UserCookie); Response.Redirect("admin/index.aspx"); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { if (RegValidate()) { lgk.Model.tb_user userInfo = new lgk.Model.tb_user(); lgk.Model.tb_user recommendInfo = userBLL.GetModel(GetUserID(this.txtRecommendCode.Value.Trim()));//推荐用户 userInfo.UserCode = txtUserCode.Value.Trim(); //会员编号 userInfo.LevelID = 1; userInfo.RecommendID = recommendInfo.UserID; //推荐人ID userInfo.RecommendCode = recommendInfo.UserCode; //推荐人编号 userInfo.RecommendPath = recommendInfo.RecommendPath; //路径 userInfo.RecommendGenera = Convert.ToInt32(recommendInfo.RecommendGenera + 1); //(推荐代数)第几代 userInfo.ParentID = 0; //父节点ID userInfo.ParentCode = "-"; //父节点編號 userInfo.UserPath = "-"; //路径 userInfo.Layer = 0; //属于多少层 userInfo.LeftBalance = 0; userInfo.LeftNewScore = 0; userInfo.RightBalance = 0; userInfo.RightNewScore = 0; userInfo.LeftScore = 0; userInfo.RightScore = 0; userInfo.Location = 0; userInfo.IsOpend = 0; //是否启用 0-未激活,1-新注册, 2-已激活 userInfo.IsLock = 0; //是否被冻結(0-否,1-冻結) userInfo.IsAgent = 0; //是否报單中心(0-否,1-是) userInfo.User006 = "" /*txtAgentCode.Value.Trim()*/; userInfo.AgentsID = 0 /*agentBLL.GetAgentsID(txtAgentCode.Value.Trim(),1)*/; // //userInfo.QQnumer = txtQQnumer.Value.Trim();//QQ //userInfo.Email = txtEmail.Value.Trim();//电子邮箱 userInfo.Emoney = 0; //云盾 userInfo.BonusAccount = 0; //现金积分 userInfo.AllBonusAccount = 0; //累计现金积分账户 userInfo.StockAccount = 0; //复投积分 userInfo.ShopAccount = 0; //云图 userInfo.StockMoney = 0; //投资积分 userInfo.RegTime = DateTime.Now; //注册時間 //userInfo.OpenTime = DateTime.Now;//注册時間 userInfo.GLmoney = 0; // userInfo.BillCount = 1; // userInfo.Password = PageValidate.GetMd5(this.txtPassword.Value.Trim()); //一级密码 userInfo.SecondPassword = PageValidate.GetMd5(this.txtSecondPassword.Value.Trim()); //二级密码 userInfo.ThreePassword = PageValidate.GetMd5(Util.CreateNo()); userInfo.BankAccount = ""; //this.txtBankAccount.Value.Trim();// "銀行賬號"; userInfo.BankAccountUser = ""; // this.txtBankAccountUser.Value.Trim();// "開户姓名"; userInfo.BankName = ""; // this.dropBank.SelectedValue;// "開户銀行"; userInfo.BankBranch = ""; // this.txtBankBranch.Value.Trim();// "支行名稱"; userInfo.BankInProvince = ""; // dropProvince.SelectedItem.Text;// "銀行所在省份"; userInfo.BankInCity = ""; // "銀行所在城市"; userInfo.NiceName = string.Empty; /*string.Empty;*/ //昵称 userInfo.TrueName = ""; // "姓名"; userInfo.IdenCode = ""; // "身份证號"; string strPhoneNum = this.txtUserCode.Value.Trim(); userInfo.PhoneNum = string.IsNullOrEmpty(strPhoneNum) ? "" : strPhoneNum; // "手机號碼"; userInfo.Address = "" /*txtAddress.Value*/; //聯系地址 userInfo.User001 = 0; //--- userInfo.User002 = 0; //注册人ID userInfo.User003 = 0; //推荐人数 userInfo.User004 = 0; //投资单数标识 userInfo.User005 = ""; //资料修改标识 userInfo.User007 = ""; userInfo.User009 = ""; userInfo.User010 = Util.GetUniqueIndentifier(20);//聚元交易地址 userInfo.Gender = sex1.Checked == true ? 1 : 2; // int iQuestion = 0; //int.TryParse(dropQuestion.SelectedValue, out iQuestion); //string strQuestion = iQuestion > 0 && iQuestion <= 3 ? dropQuestion.SelectedItem.Text : string.Empty; //userInfo.SafetyCodeQuestion = strQuestion;//密保问题 //userInfo.SafetyCodeAnswer = string.IsNullOrEmpty(strQuestion) ? string.Empty : txtAnswer.Text.Trim();//密保答案 userInfo.User011 = 0; userInfo.User013 = 0; // userInfo.User018 = 1; // 推广链接注册 userInfo.RegMoney = 0; if (userBLL.Exists(txtUserCode.Value.Trim())) { MessageBox.ShowBox(this.Page, "", "该会员编号已存在,请重新注册!", Library.Enums.ModalTypes.success); //注册成功 //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("RegistrationFails") + "');", true);//注册失败,该会员编号已存在,请重新注册! } else { if (userBLL.Add(userInfo) > 0) { long userid = GetUserID(userInfo.UserCode); int statusCode; var api = new EaseMobAPIHelper(); var data = api.AccountCreate(userInfo.UserCode, userInfo.ThreePassword, out statusCode); if (statusCode == 200) { var emResult = JsonConvert.DeserializeObject <APPService.EaseMobResult>(data); if (!string.IsNullOrEmpty(emResult.error) || emResult.error == null) { int flag = flag_ActivationUser(GetUserID(userInfo.UserCode), 0); if (flag != 0) { userBLL.Delete(userid); if (flag == -1) { userBLL.Delete(userid); MessageBox.ShowBox(this.Page, "", GetLanguage("ActivationUserFail"), Library.Enums.ModalTypes.error);//激活会员失败 } else { userBLL.Delete(userid); MessageBox.ShowBox(this.Page, "", GetLanguage("RegOpenMust"), Library.Enums.ModalTypes.error);//云盾不足 } } else { MessageBox.ShowBox(this.Page, "", "注册成功", Library.Enums.ModalTypes.success);//注册成功 return; } } else { userBLL.Delete(userid); MessageBox.ShowBox(this.Page, "", "网络繁忙,注册失败.", Library.Enums.ModalTypes.error);//注册失败 } } else { userBLL.Delete(userid); LogHelper.SaveLog(data, "LinkRegister"); MessageBox.ShowBox(this.Page, "", "网络异常,注册失败", Library.Enums.ModalTypes.error);//注册失败 } } } } }
/// <summary> /// 输入验证 /// </summary> /// <returns></returns> protected bool RegValidate() { lgk.Model.tb_user recommendInfo = new lgk.Model.tb_user(); if (txtUserCode.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("PleaseNumber"), Library.Enums.ModalTypes.warning);//请输入会员编号 return(false); } if (!PageValidate.checkUserCode(txtUserCode.Value.Trim())) { MessageBox.ShowBox(this.Page, "", GetLanguage("MemberNumber"), Library.Enums.ModalTypes.warning);//会员编号必须由6-10位的英文字母或数字组成 return(false); } if (GetUserID(txtUserCode.Value.Trim()) > 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("Memberexists"), Library.Enums.ModalTypes.info);//该会员编号已存在,请重新输入! return(false); } //if (sex1.Checked != true && sex2.Checked != true) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseArea") + "');", true);//请选择注册区域 // return false; //} //int iLocation = 0; //if (sex1.Checked == true) { iLocation = 1; } //if (sex2.Checked == true) { iLocation = 2; } #region 手机号码验证 if (txtPhoneNum.Value == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("Phoneempty"), Library.Enums.ModalTypes.warning);//手机号码不能为空 return(false); } var strPhoneNum = this.txtPhoneNum.Value.Trim(); if (!string.IsNullOrEmpty(strPhoneNum) && !PageValidate.RegexPhone(strPhoneNum)) { MessageBox.ShowBox(this.Page, "", GetLanguage("PhoneMust"), Library.Enums.ModalTypes.error);//联系电话格式错误 return(false); } int userid = GetUserIDbByPhone(strPhoneNum); if (userid > 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("PhoneRegExists"), Library.Enums.ModalTypes.info);//该手机号码已注册 return(false); } if (appId == "Open") { if (verifid_code.Value.Trim() == "") { MessageBox.ResponseScript(this, "msg_disp('请输入验证码!');"); return(false); } DataSet ds = new lgk.BLL.SMS().GetList(" IsValid=0 and ToUserCode='" + Session.SessionID + "' and ToPhone='" + txtPhoneNum.Value.Trim() + "' and SCode='" + verifid_code.Value.Trim() + "' and ValidTime >= getdate() "); if (ds == null || ds.Tables == null || ds.Tables[0] == null || ds.Tables[0].Rows.Count <= 0) { MessageBox.ResponseScript(this, "msg_disp('验证码无效!');"); return(false); } else { lgk.Model.SMS sms = new lgk.BLL.SMS().GetModel(long.Parse(ds.Tables[0].Rows[0]["ID"].ToString())); sms.IsValid = -1; new lgk.BLL.SMS().Update(sms); CacheHelper.Remove(Session.SessionID); } } #endregion #region 密码验证 if (txtPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("PasswordISNull"), Library.Enums.ModalTypes.warning);//登录密码不能为空 return(false); } if (txtSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return(false); } #endregion #region 推荐人验证 if (txtRecommendCode.Value == "") { MessageBox.ShowBox(this.Page, GetLanguage("ReferenceNumberIsnull"), Library.Enums.ModalTypes.warning);//推荐人编号不能为空 return(false); } else { string reName = this.txtRecommendCode.Value.Trim(); recommendInfo = userBLL.GetModel(GetUserID(reName));//推薦用户 if (recommendInfo == null) { MessageBox.ShowBox(this.Page, "", GetLanguage("featuredNotExist"), Library.Enums.ModalTypes.warning);//该推荐会员不存在 return(false); } if (recommendInfo.IsOpend == 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("MemberISNull"), Library.Enums.ModalTypes.warning);//该会员尚未开通,不能作为推荐会员 return(false); } } #endregion return(true); }