/// <summary> /// 增加一条数据 /// </summary> public void Add(BCW.Model.User model) { dal.Add(model); try { string xmlPath = "/Controls/winners.xml"; string TextForUbb = (ub.GetSub("TextForUbb", xmlPath)); //设置内线提示的文字 string WinnersStatus = (ub.GetSub("WinnersStatus", xmlPath)); //状态1维护2测试0正常 string WinnersOpenOrClose = (ub.GetSub("WinnersOpenOrClose", xmlPath)); //0|停止放送机会|1|开启放送机会 string WinnersOpenChoose = (ub.GetSub("WinnersOpenChoose", xmlPath)); //1全社区2社区3仅游戏 string WinnersGuessOpen = (ub.GetSub("WinnersGuessOpen", xmlPath)); //1发内线2不发内线 int usid = model.ID; string username = model.UsName;; string Notes = "新注册会员"; int id = new BCW.BLL.Action().GetMaxId(); int isHit = new BCW.winners.winners().CheckActionForAll(0, 0, usid, username, Notes, id); if (isHit == 1) { if (WinnersGuessOpen == "1") { new BCW.BLL.Guest().Add(0, usid, username, TextForUbb);//发内线到该ID } } } catch { } }
private void RegMePage() { for (int i = 0; i < 1000; i++) { //取得会员ID int maxId = 0; maxId = GetRandId(); if (maxId == 0) { continue; } //加密用户密码 string strPwd = Utils.MD5Str("123abc998"); //取随机识别串 string UsKey = new Rand().RandNum(10); string newName = ub.GetSub("RegName", "/Controls/reg.xml"); //if (newName == "") newName = "博艺会员"; //写入注册表 BCW.Model.User model = new BCW.Model.User(); model.ID = maxId; model.Mobile = "13229780118"; model.UsName = "" + newName + "" + maxId + ""; model.UsPwd = strPwd; model.UsKey = UsKey; model.Photo = "/Files/Avatar/image0.gif"; int sexn = new Random().Next(0, 1); model.Sex = sexn; int dn = new Random().Next(1, 20); model.RegTime = DateTime.Now.AddDays(-dn); model.RegIP = Utils.GetUsIP(); model.EndTime = DateTime.Now.AddDays(-dn); model.Birth = DateTime.Parse("1980-1-1"); model.Sign = "未设置签名"; model.InviteNum = 0; model.Email = ""; model.IsVerify = 1; new BCW.BLL.User().Add(model); //发送内线 new BCW.BLL.Guest().Add(model.ID, model.UsName, ub.GetSub("RegGuest", "/Controls/reg.xml")); //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId); //设置keys string keys = string.Empty;; keys = BCW.User.Users.SetUserKeys(maxId, strPwd, UsKey); builder.Append(i + ".注册成功:" + model.UsName + " 密码:123abc998<br />"); } }
protected void Page_Load(object sender, EventArgs e) { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } int UsId = meid; BCW.Model.User model = new BCW.Model.User(); model = new BCW.BLL.User().GetKey(UsId); string UsKey = model.UsKey; string UsPwd = model.UsPwd; //加密用户密码 string strPwd = Utils.MD5Str(UsPwd.Trim()); //设置keys string keys = ""; keys = BCW.User.Users.SetUserKeys(UsId, UsPwd, UsKey); string bUrl = string.Empty; if (Utils.getPage(1) != "") { bUrl = Utils.getUrl(Utils.removeUVe(Utils.getPage(1))); } else { bUrl = Utils.getUrl("/default.aspx"); } //更新识别串 string SID = ConfigHelper.GetConfigString("SID"); bUrl = UrlOper.UpdateParam(bUrl, SID, keys); Master.Title = "登录成功"; builder.Append(Out.Tab("<div class=\"title\">登录成功</div>", "")); builder.Append(Out.Tab("<div>", "")); builder.Append("保存以下书签即可<br />"); builder.Append("<a href=\"" + Utils.getUrl("" + bUrl + "") + "\">进可保存书签</a>-"); builder.Append(Out.Tab("</div>", "")); }
/// <summary> /// 修改基本资料 /// </summary> public void UpdateEditBasic(BCW.Model.User model) { dal.UpdateEditBasic(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.User model) { dal.Update(model); }
/// <summary> /// 根据手机号和密码查询影响的行数 /// </summary> public int GetRowByMobile(BCW.Model.User model) { return(dal.GetRowByMobile(model)); }
/// <summary> /// 根据ID和密码查询影响的行数 /// </summary> public int GetRowByID(BCW.Model.User model) { return(dal.GetRowByID(model)); }
private void OkPage() { Master.IsFoot = false; string mobile = Utils.GetRequest("mobile", "post", 2, @"^(?:13|14|15|18)\d{9}$", "请正确输入十一位数的手机号码"); string Pwd = Utils.GetRequest("Pwd", "post", 2, @"^[A-Za-z0-9]{6,20}$", "密码限6-20位,必须由字母或数字组成"); string Pwdr = Utils.GetRequest("Pwdr", "post", 2, @"^[A-Za-z0-9]{6,20}$", "确认密码限6-20位,必须由字母或数字组成"); int rd = 0; if (!Pwd.Equals(Pwdr)) { Utils.Error("很抱歉,您输入的两次密码不相符", ""); } if (new BCW.BLL.User().Exists(mobile)) { Utils.Error("很抱歉,此手机号已经注册", ""); } //手工注册防刷 int Expir = Utils.ParseInt(ub.GetSub("RegExpir", xmlPath2)); string CacheKey = Utils.GetUsIP(); object getObjCacheTime = DataCache.GetCache(CacheKey); if (getObjCacheTime != null) { Utils.Error(ub.GetSub("BbsGreet", "/Controls/bbs.xml"), ""); } object ObjCacheTime = DateTime.Now; DataCache.SetCache(CacheKey, ObjCacheTime, DateTime.Now.AddSeconds(Expir), TimeSpan.Zero); //取得会员ID int maxId = BCW.User.Reg.GetRandId(); if (maxId == 0) { Utils.Error("服务器繁忙,请稍后注册..", ""); } //加密用户密码 string strPwd = Utils.MD5Str(Pwd.Trim()); //取随机识别串 string UsKey = new Rand().RandNum(10); string newName = ub.GetSub("RegName", "/Controls/reg.xml"); if (newName == "") { newName = "新会员"; } string Email = string.Empty; BCW.Model.User model = new BCW.Model.User(); if (ub.GetSub("RegEmailPost", xmlPath2) == "1") { Email = Utils.GetRequest("Email", "post", 2, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", "邮箱填写错误"); if (new BCW.BLL.User().ExistsEmail(Email)) { Utils.Error("此邮箱已经被注册", ""); } model.IsVerify = 2; model.Email = Email; } else { model.IsVerify = 0; model.Email = ""; } //写入注册表 model.ID = maxId; model.Mobile = mobile; model.UsName = "" + newName + "" + maxId + ""; model.UsPwd = strPwd; model.UsKey = UsKey; model.Photo = "/Files/Avatar/image0.gif"; model.Sex = 0; model.RegTime = DateTime.Now; model.RegIP = Utils.GetUsIP(); model.EndTime = DateTime.Now; model.Birth = DateTime.Parse("1980-1-1"); model.Sign = "未设置签名"; model.InviteNum = rd; new BCW.BLL.User().Add(model); //发送内线 new BCW.BLL.Guest().Add(model.ID, model.UsName, ub.GetSub("RegGuest", "/Controls/reg.xml")); //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId); if (rd > 0 && model.IsVerify == 1) { new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RecomUser, rd); } builder.Append(Out.Tab("<div class=\"title\">免费注册会员</div>", "")); builder.Append(Out.Tab("<div>", "")); builder.Append("恭喜您注册成功!<br />"); builder.Append("注册ID:" + maxId + "<br />注册手机号:" + mobile + "<br />登录密码:" + Pwd.Trim() + ""); if (!Utils.GetDomain().Contains("dyj6")) { builder.Append("<br />重要:请编写短信<a href=\"sms:15992310086?body=111\" >111</a>到<a href=\"wtai://wp/mc;15992310086\" >15992310086</a>即可成为验证会员,未进行验证的ID系统将在7天后回收"); } builder.Append(Out.Tab("</div>", "")); //设置keys string keys = string.Empty; keys = BCW.User.Users.SetUserKeys(maxId, strPwd, UsKey); //清Cookie HttpCookie Cookie = new HttpCookie("LoginComment"); Cookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(Cookie); //写入Cookie Cookie.Expires = DateTime.Now.AddDays(30);//30天 Cookie.Values.Add("userkeys", DESEncrypt.Encrypt(Utils.Mid(keys, 0, keys.Length - 4))); Response.Cookies.Add(Cookie); if (Utils.getPage(1) != "") { builder.Append(Out.Tab("<div>", "<br />")); builder.Append("<a href=\"" + Utils.getPage("default.aspx") + "\">>>返回之前页</a>"); builder.Append(Out.Tab("</div>", "")); } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"/bbs/default.aspx?ve=" + Utils.getstrVe() + "&u=" + keys + "\">上级</a>-"); builder.Append("<a href=\"/bbs/myedit.aspx?act=basic&ve=" + Utils.getstrVe() + "&u=" + keys + "\">完善资料</a>"); builder.Append(Out.Tab("</div>", "")); }
protected void Page_Load(object sender, EventArgs e) { //执行分析 string ym = "kb288.com"; string keys = Request["keys"]; #region 支付宝掉线提示 //支付宝掉线提示 if (Request["act"] == "lostAli") { if (DESEncrypt.Decrypt(keys, "bg_rdzfb") != ym) { Response.Write("500");//提交非法 } else { string userid = Request["userid"]; string mename = new BCW.BLL.User().GetUsName(int.Parse(userid)); new BCW.BLL.Guest().Add(int.Parse(userid), mename, "您的支付宝过币程序掉线了,如非本人操作,请检查过币程序。" + DateTime.Now.ToString()); } } #endregion #region 自动过币 if (Request["act"] == "zfb") { string userid = Request["userid"]; string userpass = Request["userpass"]; string cent = Request["cent"]; string toid = Request["toid"]; string zfbNo = Request["zfbNo"]; if (DESEncrypt.Decrypt(keys, "bg_rdzfb") != ym) { Response.Write("500");//提交非法 } else { try { int meid = Convert.ToInt32(userid); if (!new BCW.BLL.User().Exists(meid)) { Response.Write("300");//自己ID不存在 } else { BCW.Model.User modellogin = new BCW.Model.User(); modellogin.UsPwd = Utils.MD5Str(userpass); modellogin.ID = meid; string mename = new BCW.BLL.User().GetUsName(meid); int rowsAffected = new BCW.BLL.User().GetRowByID(modellogin); int ToId = Convert.ToInt32(toid); if (rowsAffected > 0) { long mycent = new BCW.BLL.User().GetGold(meid); long outcent = Convert.ToInt64(cent); if (outcent > mycent) { Response.Write("201");//币币不足 new BCW.BLL.Guest().Add(meid, mename, "帐户币值不足以过币给ID" + ToId + ",转币失败(支," + zfbNo + ")"); } else { if (!new BCW.BLL.User().Exists(ToId)) { Response.Write("202");//对方ID不存在 //开始过币 new BCW.BLL.Guest().Add(meid, mename, "ID" + ToId + "不存在,转币失败(支," + zfbNo + ")"); } else { //检查订单号是否重复 zfbNo = Out.UBB(zfbNo); if (new BCW.BLL.Transfer().Exists(meid, zfbNo)) { Response.Write("203");//订单重复提交 } else { //开始过币 string toname = new BCW.BLL.User().GetUsName(ToId); new BCW.BLL.User().UpdateiGold(meid, mename, -outcent, "过户给ID" + ToId + "(支付宝自动)"); new BCW.BLL.User().UpdateiGold(ToId, toname, outcent, "来自ID" + meid + "过户(支付宝自动)"); BCW.Model.Transfer model = new BCW.Model.Transfer(); model.Types = 0; model.FromId = meid; model.FromName = mename; model.ToId = ToId; model.ToName = toname; model.AcCent = outcent; model.AddTime = DateTime.Now; model.zfbNo = zfbNo; new BCW.BLL.Transfer().Add(model); //系统内线消息 new BCW.BLL.Guest().Add(ToId, toname, "[url=/bbs/uinfo.aspx?uid=" + meid + "]" + mename + "[/url]过户" + outcent + "" + ub.Get("SiteBz") + "给您(支," + zfbNo + ")"); new BCW.BLL.Guest().Add(meid, mename, "您过户" + outcent + "" + ub.Get("SiteBz") + "给[url=/bbs/uinfo.aspx?uid=" + ToId + "] " + toname + " [/url]成功(支," + zfbNo + ")"); Response.Write("200");//成功 } } } } else { Response.Write("301");//密码错 } } } catch { Response.Write("400");//未知错误 } } } #endregion }
//---------------------------------------------knnnk.com-------------------------------------------- /// <summary> /// 取消积分操作 /// </summary> private void OkPage() { if (ub.GetSub("RegLeibie", xmlPath2) == "0" || ub.GetSub("RegLeibie", xmlPath2) == "3") { Utils.Error("手工注册已关闭", ""); } Master.IsFoot = false; string mobile = Utils.GetRequest("mobile", "post", 2, @"^(?:11|12|13|14|15|16|17|18|19)\d{9}$", "请正确输入十一位数的手机号码"); string code = Utils.GetRequest("code", "post", 2, @"^[0-9]{4}$", "请输入验证码!"); //界面图形验证码 //// string phoneCode = Utils.GetRequest("phoneCode", "post", 2, @"^[0-9]{4}$", "请输入手机验证码"); //手机验证码 string mycode = ""; try { mycode = Request.Cookies["validateCookie"].Values["ChkCode"].ToString();// 图形验证码 } catch { } string Pwd = Utils.GetRequest("Pwd", "post", 2, @"^[A-Za-z0-9]{6,20}$", "密码限6-20位,必须由字母或数字组成"); string Pwdr = Utils.GetRequest("Pwdr", "post", 2, @"^[A-Za-z0-9]{6,20}$", "确认密码限6-20位,必须由字母或数字组成"); int rd = int.Parse(Utils.GetRequest("rd", "post", 1, @"^[1-9]\d*$", "0")); code = Utils.GetRequest("code", "post", 1, @"^[0-9]{4}$", ""); //界面图形验证码 mycode = Request.Cookies["validateCookie"].Values["ChkCode"].ToString(); // 图形验证码 if (!code.Equals(mycode)) //验证码相等 { Utils.Error("很抱歉,您输入图形验证码不对,请刷新页面", ""); } if (!Pwd.Equals(Pwdr)) { Utils.Error("很抱歉,您输入的两次密码不相符", ""); } if (new BCW.BLL.User().Exists(mobile)) { Utils.Error("很抱歉,此手机号已经注册", ""); } if (rd > 0) { if (!new BCW.BLL.User().Exists(rd)) { Utils.Success("注册会员", "注册地址失效,请<a href=\"/bbs/reg.aspx\">重新注册</a>", "reg.aspx", "2"); } } //手工注册防刷 int Expir = Utils.ParseInt(ub.GetSub("RegExpir", xmlPath2)); string CacheKey = Utils.GetUsIP(); object getObjCacheTime = DataCache.GetCache(CacheKey); if (getObjCacheTime != null) { Utils.Error(ub.GetSub("BbsGreet", "/Controls/bbs.xml"), ""); } object ObjCacheTime = DateTime.Now; DataCache.SetCache(CacheKey, ObjCacheTime, DateTime.Now.AddSeconds(Expir), TimeSpan.Zero); //取得会员ID int maxId = BCW.User.Reg.GetRandId(); // int maxId = new BCW.BLL.User().GetMaxId() + 1; if (maxId == 0) { Utils.Error("服务器繁忙,请稍后注册..", ""); } //加密用户密码 string strPwd = Utils.MD5Str(Pwd.Trim()); //取随机识别串 string UsKey = new Rand().RandNum(10); string newName = ub.GetSub("RegName", "/Controls/reg.xml"); if (newName == "") { newName = "新会员"; } string Email = string.Empty; BCW.Model.User model = new BCW.Model.User(); if (ub.GetSub("RegEmailPost", xmlPath2) == "1") { Email = Utils.GetRequest("Email", "post", 2, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", "邮箱填写错误"); if (new BCW.BLL.User().ExistsEmail(Email)) { Utils.Error("此邮箱已经被注册", ""); } model.IsVerify = 2; model.Email = Email; } else { model.IsVerify = 0; model.Email = ""; } //写入注册表 model.ID = maxId; model.Mobile = mobile; model.UsName = "" + newName + "" + maxId + ""; model.UsPwd = strPwd; model.UsKey = UsKey; model.Photo = "/Files/Avatar/image0.gif"; model.Sex = 0; model.RegTime = DateTime.Now; model.RegIP = Utils.GetUsIP(); model.EndTime = DateTime.Now; model.Birth = DateTime.Parse("1980-1-1"); model.Sign = "未设置签名"; model.InviteNum = rd; new BCW.BLL.User().Add(model); //发送内线 new BCW.BLL.Guest().Add(model.ID, model.UsName, ub.GetSub("RegGuest", "/Controls/reg.xml")); ////积分操作 //new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId); //if (rd > 0 && model.IsVerify == 1) //{ // new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RecomUser, rd); //} builder.Append(Out.Tab("<div class=\"title\">免费注册会员</div>", "")); if (ub.GetSub("RegEmailPost", xmlPath2) == "1") { #region 邮箱 //设置keys string keys = ""; keys = BCW.User.Users.SetUserKeys(model.ID, model.UsPwd, model.UsKey); string VE = ConfigHelper.GetConfigString("VE"); string SID = ConfigHelper.GetConfigString("SID"); string strUrl = "http://" + Utils.GetDomain() + "/bbs/myedit.aspx?act=regyz&postId=" + DESEncrypt.Encrypt(UsKey, "ct201200108") + "&" + VE + "=2a&" + SID + "=" + keys; //设定参数 string EmailFrom = "*****@*****.**"; string EmailFromUser = "******"; string EmailFromPwd = "bichengwei"; string EmailFromHost = "smtp.gmail.com"; string EmailFromPort = "587"; if (ub.GetSub("EmailFrom", xmlPath) != "" && ub.GetSub("EmailFromUser", xmlPath) != "" && ub.GetSub("EmailFromPwd", xmlPath) != "" && ub.GetSub("EmailFromHost", xmlPath) != "" && ub.GetSub("EmailFromPort", xmlPath) != "") { EmailFrom = ub.GetSub("EmailFrom", xmlPath); EmailFromUser = ub.GetSub("EmailFromUser", xmlPath); EmailFromPwd = ub.GetSub("EmailFromPwd", xmlPath); EmailFromHost = ub.GetSub("EmailFromHost", xmlPath); EmailFromPort = ub.GetSub("EmailFromPort", xmlPath); } // 发件人地址 string From = EmailFrom; // 收件人地址 string To = Email; // 邮件主题 string Subject = "来自" + ub.Get("SiteName").ToString() + "-注册系统"; // 邮件正文 string Body = "尊敬的" + model.UsName + "您好:<br>你的手机号:" + mobile + "<br>会员ID号:" + model.ID + "<br>登录密码:" + Pwd.Trim() + "<br>点击以下链接马上完成本次注册:<br><a href=\"" + strUrl + "\">" + strUrl + "</a><br>如果无法点击链接,请复制进地址栏再进入即可<br>此信件属系统自动发送,请勿回复"; // 邮件主机地址 string Host = EmailFromHost; // 邮件主机端口 int Port = Utils.ParseInt(EmailFromPort); // 登录帐号 string UserName = EmailFromUser; // 登录密码 string Password = EmailFromPwd; //附件地址 string FilePath = ""; new SendMail().Send(From, To, Subject, Body, Host, Port, UserName, Password, FilePath); builder.Append(Out.Tab("<div>", "")); builder.Append("恭喜您提交成功!<br />"); builder.Append("系统已经将你的注册信息发送至您的邮箱,请登录邮箱验证链接即可完成注册.<br />您可能收不到邮件?请进入垃圾箱找找看."); builder.Append(Out.Tab("</div>", "")); #endregion } else { #region 手工注册 builder.Append(Out.Tab("<div>", "")); builder.Append("恭喜您注册成功!<br />"); builder.Append("注册ID:" + maxId + "<br />注册手机号:" + mobile + "<br />登录密码:" + Pwd.Trim() + ""); // builder.Append("<br />重要:请编写短信<a href=\"sms:15992310086?body=111\" >111</a>到<a href=\"wtai://wp/mc;15992310086\" >15992310086</a>即可成为验证会员,未进行验证的ID系统将在7天后回收"); builder.Append("<br/><a href=\"" + Utils.getUrl("reg.aspx?act=validate") + "\">马上验证为会员!>></a>"); builder.Append(Out.Tab("</div>", "")); //设置keys string keys = string.Empty; keys = BCW.User.Users.SetUserKeys(maxId, strPwd, UsKey); //清Cookie HttpCookie Cookie = new HttpCookie("LoginComment"); Cookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(Cookie); //写入Cookie Cookie.Expires = DateTime.Now.AddDays(30);//30天 //Cookie.Values.Add("userkeys", DESEncrypt.Encrypt(Utils.Mid(keys, 0, keys.Length - 4))); //Response.Cookies.Add(Cookie); if (Utils.getPage(1) != "") { builder.Append(Out.Tab("<div>", "<br />")); builder.Append("<a href=\"" + Utils.getPage("default.aspx") + "\">>>返回之前页</a>"); builder.Append(Out.Tab("</div>", "")); } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"/bbs/default.aspx?ve=" + Utils.getstrVe() + "&u=" + keys + "\">上级</a>-"); builder.Append("<a href=\"/bbs/myedit.aspx?act=basic&ve=" + Utils.getstrVe() + "&u=" + keys + "\">完善资料</a>"); builder.Append(Out.Tab("</div>", "")); #endregion } }
private void RegPwdOkPage() { Master.Title = "免费注册/重置密码"; if (Utils.GetTopDomain() == "knnnk.com") { int meid = new BCW.User.Users().GetUsId(); if (meid != 1 && meid != 2) { Utils.Error("权限不足", ""); } string mobile = Utils.GetRequest("mobile", "post", 2, @"^(?:13|14|15|18)\d{9}$", "请正确输入十一位数的手机号码"); string ac = Utils.GetRequest("ac", "all", 1, "", ""); builder.Append(Out.Tab("<div class=\"title\">免费注册/重置密码</div>", "")); if (Utils.ToSChinese(ac) == "注册会员") { if (new BCW.BLL.User().Exists(mobile)) { Utils.Error("很抱歉,此手机号已经注册", ""); } //取得会员ID int maxId = BCW.User.Reg.GetRandId(); if (maxId == 0) { Utils.Error("很抱歉,服务器繁忙,请稍后注册..", ""); } //加密用户密码 string strPwd = Utils.MD5Str(Utils.Right(mobile, 6)); //取随机识别串 string UsKey = new Rand().RandNum(10); string newName = ub.GetSub("RegName", "/Controls/reg.xml"); if (newName == "") { newName = "新会员"; } //写入注册表 BCW.Model.User model = new BCW.Model.User(); model.ID = maxId; model.Mobile = mobile; model.UsName = "" + newName + "" + maxId + ""; model.UsPwd = strPwd; model.UsKey = UsKey; model.Photo = "/Files/Avatar/image0.gif"; model.Sex = 0; model.RegTime = DateTime.Now; model.RegIP = Utils.GetUsIP(); model.EndTime = DateTime.Now; model.Birth = DateTime.Parse("1980-1-1"); model.Sign = "未设置签名"; model.InviteNum = 0; model.IsVerify = 0; model.Email = ""; new BCW.BLL.User().Add(model); //发送内线 new BCW.BLL.Guest().Add(model.ID, model.UsName, ub.GetSub("RegGuest", "/Controls/reg.xml")); //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId); builder.Append(Out.Tab("<div>", "")); builder.Append("注册成功!<br />"); builder.Append("注册ID:" + maxId + "<br />注册手机号:" + mobile + "<br />登录密码:" + Utils.Right(mobile, 6) + ""); builder.Append(Out.Tab("</div>", "")); } else if (Utils.ToSChinese(ac) == "重置密码") { if (BCW.User.Reg.GetPwdSms(mobile))//找回登录密码 { builder.Append(Out.Tab("<div>", "")); builder.Append("重置密码成功!<br />"); builder.Append("手机号:" + mobile + "<br />登录密码:" + Utils.Right(mobile, 6) + ""); builder.Append(Out.Tab("</div>", "")); } } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("default.aspx") + "\">上级</a>"); builder.Append(Out.Tab("</div>", "")); } }
private void OkPage() { Master.Title = "注册会员"; string mobile = Utils.GetRequest("mobile", "post", 2, @"^[0-9]\d{10,10}$", "请正确输入十一位数的手机号码"); string Pwd = Utils.GetRequest("Pwd", "post", 3, @"^[A-Za-z0-9]{6,20}$", "密码限6-20位,必须由字母或数字组成"); int Rid = int.Parse(Utils.GetRequest("Rid", "post", 1, @"^[0-9]\d*$", "0")); int rd = int.Parse(Utils.GetRequest("rd", "post", 1, @"^[0-9]\d*$", "0")); if (Pwd == "") { Pwd = Utils.Right(mobile, 6); } if (new BCW.BLL.User().Exists(mobile)) { Utils.Error("很抱歉,此手机号已经注册", ""); } //取得会员ID int maxId = 0; if (Rid == 0) { //maxId = BCW.User.Reg.GetRandId(); maxId = GetRandId(); if (maxId == 0) { Utils.Error("很抱歉,服务器繁忙,请稍后注册..", ""); } } else { if (new BCW.BLL.User().Exists(Rid)) { Utils.Error("很抱歉,此ID已经注册", ""); } maxId = Rid; } //加密用户密码 string strPwd = Utils.MD5Str(Pwd.Trim()); //取随机识别串 string UsKey = new Rand().RandNum(10); string newName = ub.GetSub("RegName", "/Controls/reg.xml"); if (newName == "") { newName = "新会员"; } if (rd > 0) { if (!new BCW.BLL.User().Exists(rd)) { Utils.Error("很抱歉,推荐ID不存在", ""); } } //写入注册表 BCW.Model.User model = new BCW.Model.User(); model.ID = maxId; model.Mobile = mobile; model.UsName = "" + newName + "" + maxId + ""; model.UsPwd = strPwd; model.UsKey = UsKey; model.Photo = "/Files/Avatar/image0.gif"; model.Sex = 0; model.RegTime = DateTime.Now; model.RegIP = Utils.GetUsIP(); model.EndTime = DateTime.Now; model.Birth = DateTime.Parse("1980-1-1"); model.Sign = "未设置签名"; model.InviteNum = rd; model.Email = ""; model.IsVerify = 1; new BCW.BLL.User().Add(model); //发送内线 new BCW.BLL.Guest().Add(model.ID, model.UsName, ub.GetSub("RegGuest", "/Controls/reg.xml")); //积分操作 new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId); if (rd > 0) { new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RecomUser, rd); } //设置keys string keys = string.Empty;; keys = BCW.User.Users.SetUserKeys(maxId, strPwd, UsKey); builder.Append(Out.Tab("<div class=\"title\">注册会员</div>", "")); builder.Append(Out.Tab("<div>", "")); builder.Append("恭喜注册成功!<br />"); builder.Append("注册ID:" + maxId + "<br />注册手机号:" + mobile + "<br />登录密码:" + Pwd.Trim() + ""); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("uinfo.aspx") + "\">会员管理</a><br />"); builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>")); builder.Append(Out.Tab("</div>", "<br />")); }
//机器人初始化 public virtual void Init(int _meid) { meid = _meid; self = new BCW.BLL.User().GetBasic(_meid); }
private void OkPage() { string Name = Utils.GetRequest("Name", "post", 2, @"^\d{1,10}$|^(?:13|14|15|18)\d{9}$", "请正确输入ID或者手机号"); string Pwd = Utils.GetRequest("Pwd", "post", 2, @"^[A-Za-z0-9]{6,20}$", "请正确输入您的密码"); bool IsMy = bool.Parse(Utils.GetRequest("IsMy", "post", 1, @"^True|False$", "False")); int State = int.Parse(Utils.GetRequest("State", "post", 1, @"^[0-1]$", "0")); int rowsAffected = 0; BCW.Model.User modellogin = new BCW.Model.User(); modellogin.UsPwd = Utils.MD5Str(Pwd); if (Name.Length == 11) { modellogin.Mobile = Name; rowsAffected = new BCW.BLL.User().GetRowByMobile(modellogin); } else { modellogin.ID = Convert.ToInt32(Name); rowsAffected = new BCW.BLL.User().GetRowByID(modellogin); } if (rowsAffected > 0) { BCW.Model.User model = new BCW.Model.User(); //if (Name.Length == 11) //{ // model = new BCW.BLL.User().GetKey(Name); //} //else //{ //model = new BCW.BLL.User().GetKey(Convert.ToInt32(Name)); //} model = new BCW.BLL.User().GetKey(rowsAffected); int UsId = model.ID; string UsKey = model.UsKey; string UsPwd = model.UsPwd; int IsVerify = model.IsVerify; if (IsVerify == 2) { Utils.Error("您的ID还没有通过邮箱验证,如您没到验证邮件,<a href=\"" + Utils.getUrl("reg.aspx?act=reemail") + "\">请重试</a>", ""); } string ac = Utils.GetRequest("ac", "all", 1, "", ""); if (Utils.ToSChinese(ac) == "安全登录") { //取随机识别串 UsKey = new Rand().RandNum(10); new BCW.BLL.User().UpdateUsKey(UsId, UsKey); } //加密用户密码 string strPwd = Utils.MD5Str(UsPwd.Trim()); //设置keys string keys = ""; keys = BCW.User.Users.SetUserKeys(UsId, UsPwd, UsKey); string bUrl = string.Empty; if (Utils.getPage(1) != "") { bUrl = Utils.getUrl(Utils.removeUVe(Utils.getPage(1))); } else { bUrl = Utils.getUrl("/default.aspx"); } //更新识别串 string SID = ConfigHelper.GetConfigString("SID"); bUrl = UrlOper.UpdateParam(bUrl, SID, keys); //写入Cookie if (IsMy == true) { HttpCookie cookie = new HttpCookie("LoginComment"); cookie.Expires = DateTime.Now.AddDays(30);//30天 cookie.Values.Add("userkeys", DESEncrypt.Encrypt(Utils.Mid(keys, 0, keys.Length - 4))); Response.Cookies.Add(cookie); } else { //清Cookie HttpCookie Cookie = new HttpCookie("LoginComment"); Cookie.Expires = DateTime.Now.AddDays(-1); HttpContext.Current.Response.Cookies.Add(Cookie); } if (Request["IsMy"] == "pwd") { string ForumSet = new BCW.BLL.User().GetForumSet(UsId); string[] fs = ForumSet.Split(",".ToCharArray()); string sforumsets = string.Empty; for (int i = 0; i < fs.Length; i++) { string[] sfs = fs[i].ToString().Split("|".ToCharArray()); if (i == 25) { sforumsets += "," + sfs[0] + "|" + DateTime.Now; } else { sforumsets += "," + sfs[0] + "|" + sfs[1]; } } sforumsets = Utils.Mid(sforumsets, 1, sforumsets.Length); new BCW.BLL.User().UpdateForumSet(UsId, sforumsets); } //----------------------写入登录日志文件作永久保存 try { string MyIP = Utils.GetUsIP(); string ipCity = string.Empty; if (!string.IsNullOrEmpty(MyIP)) { ipCity = new IPSearch().GetAddressWithIP(MyIP); if (!string.IsNullOrEmpty(ipCity)) { ipCity = ipCity.Replace("IANA保留地址 CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":"; } string FilePath = System.Web.HttpContext.Current.Server.MapPath("/log/loginip/" + UsId + "_" + DESEncrypt.Encrypt(UsId.ToString(), "kubaoLogenpt") + ".log"); LogHelper.Write(FilePath, "" + ipCity + "" + MyIP + "(登录)"); } } catch { } //----------------------写入日志文件作永久保存 new BCW.BLL.User().UpdateTime(UsId); //VIP隐身 int VipLeven = BCW.User.Users.VipLeven(UsId); if (new BCW.BLL.Role().IsAllMode(UsId) == false && VipLeven > 0) { new BCW.BLL.User().UpdateState(UsId, 1); } Utils.Success("登录成功", "登录成功!返回登录前的页面..<br />如果没有自动跳转,请点击以下链接..", Out.SysUBB(bUrl), "2"); } else { Utils.Error("登录失败,会员ID/手机号码或密码错误", ""); } }