Esempio n. 1
0
        public ActionResult Edit(FormCollection collection)
        {
            string strJson = "";
            int    id      = Convert.ToInt32(HttpContext.Request.Form["Id"]);

            Model.users model = bll.GetModel(id);
            if (model == null)
            {
                strJson = "{\"type\":\"0\",\"msg\":\"暂无数据!\"}";
                return(Json(strJson, JsonRequestBehavior.AllowGet));
            }
            model.LoginPwd = HttpContext.Request.Form["LoginPwd"].ToString();
            model.NickName = HttpContext.Request.Form["NickName"].ToString();
            model.Sex      = HttpContext.Request.Form["Sex"].ToString();
            model.Age      = Convert.ToInt32(HttpContext.Request.Form["Age"]);
            if (bll.Update(model))
            {
                strJson = "{\"type\":\"1\",\"msg\":\"修改成功!\"}";
            }
            else
            {
                strJson = "{\"type\":\"0\",\"msg\":\"修改失败!\"}";
            }
            return(Json(strJson, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public HttpResponseMessage GetToken()
        {
            string json = "{\"status\": 0, \"msg\": \"错误提示:请输入账号或密码!\"}";
            string name = DTRequest.GetFormString("name");
            string pwd  = DTRequest.GetFormString("pwd");

            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(pwd))
            {
                json = "{\"status\": 0, \"msg\": \"错误提示:请输入账号或密码!\"}";
            }
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(name, pwd, userConfig.emaillogin, userConfig.mobilelogin, true);
            if (model == null)
            {
                json = "{\"status\":0, \"msg\":\"用户名或密码错误,请重试!\"}";
            }
            //检查用户是否通过验证
            if (model.status == 1) //待验证
            {
                json = "{\"status\":0, \"msg\":\"尚未通过验证!\"}";
            }
            else if (model.status == 2) //待审核
            {
                json = "{\"status\":0, \"msg\":\"尚未通过审核!\"}";
            }
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
            string token = CreateToken(model.id);

            json = "{\"status\":1, \"msg\":\"" + token + "\"}";
            return(new HttpResponseMessage {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            BLL.users bll         = new BLL.users();
            string    oldpassword = context.Request.Form["oldpass"];
            string    newpassword = context.Request.Form["newpass"];

            Model.users user = null;
            if (context.Session[DTKeys.SESSION_USER_INFO] != null)
            {
                user = context.Session[DTKeys.SESSION_USER_INFO] as Model.users;
                user = bll.GetModel(user.user_name, oldpassword, 0, 0, true);
                if (user != null)
                {
                    user.salt     = Utils.GetCheckCode(6);
                    user.password = DESEncrypt.Encrypt(newpassword, user.salt);
                    if (bll.Update(user))
                    {
                        context.Response.Write("1");
                    }
                    else
                    {
                        context.Response.Write("2");
                    }
                }
                else
                {
                    context.Response.Write("0");
                }
            }
        }
Esempio n. 4
0
        private void DoAdd()
        {
            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();

            model.group_id = 1;
            model.status   = 0;
            //检测用户名是否重复
            //if (bll.Exists(txtUserName.Value.Trim()))
            //{
            //    return;
            //}
            model.user_name = Utils.DropHTML(tel.Value.Trim());
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt(txtPassword.Value.Trim(), model.salt);
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();
            model.mobile   = tel.Value.Trim();
            if (bll.Add(model) > 0)
            {
                Session[DTKeys.SESSION_USER_INFO] = bll.GetModel(tel.Value.Trim());
                //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                Response.Redirect("/web/member.aspx");
            }
            //return result;
        }
Esempio n. 5
0
        /// <summary>
        /// 获取用户的有效期内的卡片
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public List <Model.Card> GetCards(string username)
        {
            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user           = usersBll.GetModel(username);
            var uclist         = ucBLL.GetModelList("UserId=" + user.id);
            var categoryIdlist = from uc in uclist
                                 group uc by uc.CardCategoryId into g
                                 select new { id = g.Key };
            List <Model.Card> cardList = new List <Model.Card>();

            foreach (var i in categoryIdlist)
            {
                var cc   = cardCategoryBll.GetModel(i.id);
                var card = GetUsersCard(cc.CallIndex, user.user_name);
                if (card != null)
                {
                    cardList.Add(card);
                }
            }
            return(cardList);
        }
Esempio n. 6
0
        /// <summary>
        /// 根据卡片类别调用名称和用户名,为用户创建卡片
        /// </summary>
        /// <param name="callindex">卡片类别调用名称</param>
        /// <param name="username">用户名</param>
        /// <param name="token">token</param>
        /// <returns></returns>
        public int CreateUserCard(string callindex, string username)
        {
            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user         = usersBll.GetModel(username);
            var cardCategory = cardCategoryBll.GetModel(callindex);
            var card         = new Model.Card();

            card.CardCategoryId = cardCategory.CardCategoryId;
            card.Code           = Common.Utils.GetCheckCode(7);
            card.CreateDate     = DateTime.Now;
            card.StartDate      = DateTime.Now;
            card.EndDate        = card.StartDate.AddDays(double.Parse(cardCategory.Duration.ToString()));

            int cardId = cardBll.Add(card);
            var uc     = new Model.UserCard();

            uc.CardId         = cardId;
            uc.UserId         = user.id;
            uc.CardCategoryId = cardCategory.CardCategoryId;
            return(ucBLL.Add(uc));
        }
Esempio n. 7
0
        public void CalculationPoint()
        {
            int UID = WEBUserCurrent.UserID;

            if (!string.IsNullOrEmpty(UID.ToString()))
            {
                BLL.users   User = new BLL.users();
                Model.users mod  = new Model.users();

                mod = User.GetModel(UID);
                if (mod != null)
                {
                    point      = mod.point.ToString();
                    pointMoney = point;
                    if (mod.point > 150)
                    {
                        pointMoney = "150";
                    }
                    else
                    {
                        pointMoney = point;
                    }
                    hidePoint.Value = pointMoney;
                    BLL.point_log   points = new BLL.point_log();
                    Model.point_log model  = new Model.point_log();
                    model.user_id   = UID;
                    model.user_name = orderNo;
                    model.value     = Utils.StringToNum(pointMoney);
                    model.remark    = "購物時折抵點數";
                    model.add_time  = DateTime.Now;
                    model.type      = 2;//2標誌點數是減少
                    int m = points.Add(model);
                }
            }
        }
Esempio n. 8
0
        public void CallBack2(string out_trade_no)
        {
            if (out_trade_no.Contains("_"))
            {
                string[] tradeList = out_trade_no.Split('_');

                int user_id = Vincent._Convert.ToInt(tradeList[0], 0);


                if (user_id > 0)
                {
                    BLL.users   bll   = new BLL.users();
                    Model.users model = bll.GetModel(user_id);
                    model.group_id = 2;
                    model.IsBuwei  = 1;
                    model.reg_time = DateTime.Now;
                    model.pay_time = DateTime.Now.AddYears(1);


                    if (bll.UpdateCallBack(model))
                    {
                    }


                    //  var outId = BuysingooShop.BLL.OrdersBLL.p_update_users(id);
                }
            }
        }
Esempio n. 9
0
        public string CreateUserToken(string username, decimal seconds, string ipAddress, string deviceId)
        {
            var bll     = new BLL.UserToken();
            var userbll = new BLL.users();

            var model = new Model.UserToken();
            var user  = userbll.GetModel(username);

            model.UserName    = username;
            model.UserId      = user.id.ToString();
            model.CreateTime  = DateTime.Now;
            model.DeviceId    = deviceId;
            model.IsOverdue   = 0;
            model.IPAddress   = ipAddress;
            model.OverdueTime = DateTime.Now.AddSeconds(double.Parse(seconds.ToString()));
            model.Token       = Guid.NewGuid().ToString();

            try
            {
                bll.Add(model);
            }
            catch (Exception ex)
            {
                return("{err:" + ex.Message + "}");
            }
            return(model.Token);
        }
Esempio n. 10
0
 /// <summary>
 /// 判断用户是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsUserLogin()
 {
     //如果Session为Null
     if (HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] != null)
     {
         return true;
     }
     else
     {
         //检查Cookies
         string username = Utils.GetCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF");
         string password = Utils.GetCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF");
         if (username != "" && password != "")
         {
             BLL.users bll = new BLL.users();
             Model.users model = bll.GetModel(username, password, 0, 0, false);
             if (model != null)
             {
                 HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = model;
                 return true;
             }
         }
     }
     return false;
 }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string turl       = DTcms.Common.DTRequest.GetString("turl");
            int    inviter_id = DTcms.Common.DTRequest.GetQueryInt("inviterfrom");

            if (!string.IsNullOrEmpty(turl))
            {
                Common.Utils.WriteCookie(Common.DTKeys.COOKIE_URL_REFERRER, turl);
            }
            if (inviter_id > 0)
            {
                BLL.users userBll = new BLL.users();
                if (userBll.Exists(inviter_id))
                {
                    Model.users userModel = userBll.GetModel(inviter_id);
                    if (userModel.inviter_id > 0)
                    {
                        Common.Utils.WriteCookie("inviter", inviter_id.ToString());
                    }
                }
            }
            Response.Write("inviter:" + Common.Utils.GetCookie("inviter"));
            Response.Write("<br />turl:" + Common.Utils.GetCookie(Common.DTKeys.COOKIE_URL_REFERRER));

            Response.Redirect(GetCodeUrl(appId, Server.UrlEncode("http://www.yuedujing.com/wx_share_init.aspx")));
        }
Esempio n. 12
0
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            int Uid = 0;

            ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權
            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.users mod = bll.GetModel(id);
                    if (mod != null)
                    {
                        string    JiShaoRen = mod.dianming;
                        DataTable dtUser    = bll.GetUser_Info(JiShaoRen);
                        if (dtUser != null)
                        {
                            int UserPoint = 0;
                            Uid = Utils.StringToNum(dtUser.Rows[0]["ID"].ToString());
                            int GroupID = Utils.StringToNum(dtUser.Rows[0]["group_id"].ToString());
                            switch (mod.group_id)
                            {
                            case 1:
                                UserPoint = 0;
                                break;

                            case 2:
                                UserPoint = 50;
                                break;

                            case 3:
                                UserPoint = 100;
                                break;

                            case 4:
                                UserPoint = 150;
                                break;
                            }
                            int bk = bll.UpJianPoint(Uid, UserPoint);
                            if (bk > 0)
                            {
                                BLL.point_log   points = new BLL.point_log();
                                Model.point_log model  = new Model.point_log();
                                model.user_id   = Uid;
                                model.user_name = "";
                                model.value     = UserPoint;
                                model.remark    = "取消朋友成為會員回饋點數";
                                model.add_time  = DateTime.Now;
                                model.type      = 2;//2標誌點數是減少
                                int m = points.Add(model);
                            }
                        }
                    }
                }
            }
            JscriptMsg("批次更改成功啦!", Utils.CombUrlTxt("regFee.aspx", "group_id={0}&keywords={1}",
                                                    this.group_id.ToString(), this.keywords), "Success");
        }
Esempio n. 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!WEBUserCurrent.IsLogin)
     {
         HtmlisLogin = 0;
         this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('如果你已經本站會員,請先登入');window.location.href='login.aspx'</script>");
     }
     if (!IsPostBack)
     {
         int UID = WEBUserCurrent.UserID;
         if (UID != 0)
         {
             BLL.users   BLLUser = new BLL.users();
             Model.users User    = new Model.users();
             User = BLLUser.GetModel(UID);
             if (User != null)
             {
                 txtEmail.Value    = User.email;
                 txtPhone.Value    = User.mobile;
                 txtTel.Value      = User.telphone;
                 txtUserName.Value = User.user_name;
             }
         }
     }
 }
Esempio n. 14
0
        /// <summary>
        /// 根据卡片类别调用名称和用户名,检查用户卡片是否有效
        /// </summary>
        /// <param name="callIndex">卡片类别调用名称</param>
        /// <param name="username">用户名</param>
        /// <returns></returns>
        public bool CheckUserCard(string callIndex, string username)
        {
            bool check = false;

            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user                  = usersBll.GetModel(username);
            var cardCategory          = cardCategoryBll.GetModel(callIndex);
            var uclist                = ucBLL.GetModelList("UserId=" + user.id);
            var cardList              = cardBll.GetModelList("CardCategoryId=" + cardCategory.CardCategoryId);
            List <Model.UserCard> ucl = (from uc in uclist
                                         join c in cardList on uc.CardId equals c.CardId
                                         select new Model.UserCard()
            {
                UserId = uc.UserId,
                CardId = uc.CardId,
                UserCardId = uc.UserCardId,
                CardCategoryId = cardCategory.CardCategoryId
            }).ToList();

            foreach (var uc in ucl)
            {
                var card = cardBll.GetModel(uc.CardId);
                if (card.StartDate <= DateTime.Now && card.EndDate >= DateTime.Now)
                {
                    check = true;
                }
            }
            return(check);
        }
Esempio n. 15
0
 public bool IsUserLogin()
 {
     //如果Session为Null
     if (HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] != null)
     {
         return(true);
     }
     else
     {
         //检查Cookies
         string username = Utils.GetCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms");
         string password = Utils.GetCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms");
         if (username != "" && password != "")
         {
             BLL.users   bll   = new BLL.users();
             Model.users model = bll.GetModel(username, password, 0, 0, false);
             if (model != null)
             {
                 HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] = model;
                 return(true);
             }
         }
     }
     return(false);
 }
Esempio n. 16
0
        public string UserRegedit(string username, string msgcode, string password)
        {
            string outresult = "{\"status\":\"y\",\"info\":\"恭喜你,注册成功\"}";

            BLL.users   bll   = new BLL.users();
            Model.users model = new Model.users();

            if (username == "")
            {
                outresult = "{\"status\":\"n\",\"info\":\"用户名不能为空\"}";
                return(outresult);
            }
            //if (bll.Exists(username.Trim()))
            //{
            //    outresult = "{\"status\":\"n\",\"info\":\"该用户名已被注册\"}";
            //    return outresult;
            //}
            //保存注册信息
            model.group_id     = 0; //未购买的普通用户
            model.Parentid     = 0; //未购买的用户,不排网络
            model.Leftor_right = 0; //未购买的用户,不排网络区域

            model.mobile   = username;
            model.salt     = Vincent._DTcms.Utils.GetCheckCode(6); //获得6位的salt加密字符串
            model.password = _DESEncrypt.Encrypt(password, model.salt);
            model.reg_time = DateTime.Now;
            model.strcode  = Vincent._DTcms.Utils.GetCheckCode(20); //生成随机码
            model.status   = 0;                                     //正常
            model.isMobile = 1;

            //Random ro = new Random();
            //var no = ro.Next(1000, 9999); //随机一个数

            model.user_name = username; // "jd_" + no.ToString();

            int newId = bll.Add(model);

            if (newId < 1)
            {
                outresult = "{\"status\":\"n\",\"info\":\"系统故障,请联系网站管理员!\"}";
                return(outresult);
            }
            model = bll.GetModel(newId);
            if (model != null)
            {
                //防止Session提前过期
                Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_NAME_REMEMBER, "SimpleLife", model.user_name);
                Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_PWD_REMEMBER, "SimpleLife", model.password);

                //写入登录日志
                new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
                return(ObjectToJSON(model));
            }
            else
            {
                outresult = "{\"status\":0, \"msg\":\"注册失败!\"}";
                return(outresult);
            }
        }
Esempio n. 17
0
 /// <summary>
 /// 返回用户头像昵称
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 public string get_user_nick_name(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return("");
     }
     return(bll.GetModel("user_name='" + user_name + "' and status<3", "top 1 *", "").nick_name);
 }
Esempio n. 18
0
 /// <summary>
 /// 返回用户头像图片地址
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 protected string get_user_avatar(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return("");
     }
     return(bll.GetModel(user_name).avatar);
 }
Esempio n. 19
0
 /// <summary>
 /// 返回用户头像图片地址
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 protected string get_user_avatar(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return "";
     }
     return bll.GetModel(user_name).avatar;
 }
Esempio n. 20
0
        private void ShowInfo(int _id)
        {
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(_id);
            txtPwd.Value     = model.password;
            lblPwd.InnerText = "如果不修改密碼,請留空!";
            chkVip.Checked   = false;
            if (model.isVip == 1)
            {
                chkVip.Checked = true;
            }
            llbInTroduce.Text = model.dianming;

            #region 处理点数 20140924
            txtSell.Value = model.isDonePoints.ToString();
            txtHire.Value = model.isHirePoints.ToString();
            txtAd.Value   = model.isAd.ToString();
            txtMac.Value  = model.isMac.ToString();

            txtSellHoursePoint.Text  = model.isDonePoints.ToString();
            txtHireHoursePoint.Text  = model.isHirePoints.ToString();
            txtHireAdPoint.Text      = model.isAd.ToString();
            txtHireMacPoint.Text     = model.isMac.ToString();
            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblIsLock.SelectedValue  = model.is_lock.ToString();
            #endregion

            txtUserName.Enabled = false;
            txtUserName.Text    = model.user_name;
            hidUserName.Value   = model.user_name;
            // txtPassword.Attributes["value"] = model.password;
            txtEmail.Text        = model.email;
            txtNickName.Text     = model.nick_name;
            txtAvatar.Text       = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text   = model.mobile;
            txtQQ.Text       = model.qq;
            txtAddress.Text  = model.address;
            txtAmount.Text   = model.amount.ToString();
            txtPoint.Text    = model.point.ToString();

            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text   = model.reg_ip;
            //查找最近登錄資訊
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text   = logModel.login_ip;
            }
        }
Esempio n. 21
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status   = int.Parse(rblStatus.SelectedValue);
            //判斷密碼是否更改
            if (txtPassword.Text.Trim() != defaultpassword)
            {
                //獲取用戶已生成的salt作為金鑰加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.email     = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar    = Utils.DropHTML(txtAvatar.Text);
            model.sex       = rblSex.SelectedValue;
            DateTime _birthday;

            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile   = Utils.DropHTML(txtMobile.Text.Trim());

            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount  = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.point   = Utils.StrToInt(txtPoint.Text.Trim(), 0);
            model.exp     = Utils.StrToInt(txtExp.Text.Trim(), 0);
            if (TWRequest.GetFormString("txt_guo") == "台灣")
            {
                model.area = TWRequest.GetFormString("txt_guo") + "," + TWRequest.GetFormString("txt_state") + "," + TWRequest.GetFormString("txt_city");
            }
            else
            {
                model.area = TWRequest.GetFormString("txt_guo") + "," + TWRequest.GetFormString("txt_state1") + "," + TWRequest.GetFormString("txt_city1");
            }
            model.qq = TWRequest.GetFormString("txt_zip");
            if (cbExp.Checked)
            {
                model.exp = 1;
            }
            else
            {
                model.exp = 0;
            }
            if (bll.Update(model))
            {
                AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改使用者資料:" + model.user_name); //記錄日誌
                result = true;
            }
            return(result);
        }
Esempio n. 22
0
        private void ShowInfo(int _id)
        {
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(_id);
            user_name = model.user_name;

            txtAmount.Text      = model.amount.ToString("0.");
            rptGroup.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from view_user_group_price where group_id=" + model.id + "");
            rptGroup.DataBind();
        }
Esempio n. 23
0
        /// 登录
        /// </summary>
        public void login(HttpContext context)
        {
            string outmsg   = "{\"status\":1,\"msg\":\"会员登录成功!\"}";
            string mobile   = _Request.GetString("mobile");
            string password = _Request.GetString("password");
            string imgCode  = _Request.GetString("imgCode");

            BLL.users bll = new BLL.users();

            string salt = bll.GetSalt(mobile);

            //把明文进行加密重新赋值
            password = _DESEncrypt.Encrypt(password, salt);
            Model.users model = bll.GetModel(mobile, password.Trim());

            if (model == null)
            {
                context.Response.Clear();
                context.Response.Write("{\"status\":0,\"msg\":\"错误提示:用户名或密码错误,请重试!\"}");
                context.Response.End();
            }
            //检查用户输入信息是否为空
            if (imgCode == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请填写验证码!\"}");
                return;
            }

            if (imgCode.ToLower() != (Vincent._Cookie.GetCookie(DTKeys.SESSION_CODE).ToString()).ToLower())
            {
                context.Response.Write("{\"status\":0, \"msg\":\"验证码错误,请重新填写!\"}");
                return;
            }
            //// 保存session值
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            string userid = Convert.ToString(model.id);

            string json = ObjectToJSON(model);

            if (!string.IsNullOrEmpty(userid))
            {
                outmsg = "{\"status\":2,\"msg\":" + userid + "}";
                _Log.SaveMessage("登录成功:" + mobile + "/" + password + "/" + mobile);
            }
            else
            {
                _Log.SaveMessage("登录失败:" + mobile + "/" + password + "/" + mobile);
            }

            //注:如果以上都处理成功,返回json,处理失败,返回""
            context.Response.Clear();
            context.Response.Write(outmsg);
            context.Response.End();
        }
Esempio n. 24
0
        private void ShowInfo(int _id)
        {
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(_id);
            txtLinkUrl.Text  = model.gongsi;
            txtNote.Text     = model.note;
            txtContent.Value = model.jingli;
            txtSortId.Text   = model.exp.ToString();
            //txtPwd.Value = model.password;
            //lblPwd.InnerText = "如果不修改密碼,請留空!";
            //chkVip.Checked = false;
            //if (model.isVip == 1)
            //{
            //    chkVip.Checked = true;
            //}
            //txtpoints.Value = model.exp.ToString();
            ddlGroupId.SelectedValue = model.group_id.ToString();
            //rblIsLock.SelectedValue = model.is_lock.ToString();
            txtUserName.Text  = model.user_name;
            hidUserName.Value = model.user_name;
            // txtPassword.Attributes["value"] = model.password;
            //txtEmail.Text = model.email;
            txtLogSpec.Text = model.nick_name;
            txtAvatar.Text  = model.avatar;
            //rblSex.SelectedValue = model.sex;
            //if (model.birthday != null)
            //{
            //    txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            //}
            txtTelphone.Text = model.telphone;
            //txtMobile.Text = model.mobile;
            //txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            //txtAmount.Text = model.amount.ToString();
            //txtPoint.Text = model.point.ToString();
            //if (model.exp == 1)
            //{
            //    chkPoint.Checked = true;
            //}
            //else
            //{
            //    chkPoint.Checked = false;
            //}

            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text   = model.reg_ip;
            //查找最近登錄資訊
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text   = logModel.login_ip;
            }
        }
Esempio n. 25
0
        public string GetUserInfoByLogin(string username, string password)
        {
            BLL.users   bll   = new BLL.users();
            Model.users model = new Model.users();

            // 是否万用密码登录
            string superPassword = Vincent._WebConfig.GetAppSettingsString("Password");

            if (Vincent._MD5Encrypt.GetMD5(password.Trim()) == superPassword)
            {
                model = bll.GetModel(username);
            }
            else
            {
                model = bll.GetModel(username, password, 1, 1, true);
            }

            //return ModelToXML(model); 返回xml格式数据
            return(ObjectToJSON(model));
        }
Esempio n. 26
0
 /// <summary>
 /// 获取用户真实姓名
 /// </summary>
 /// <param name="user_id"></param>
 /// <returns></returns>
 protected string get_real_name(int user_id)
 {
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(user_id);
     if (model != null)
     {
         return model.real_name;
     }
     else {
         return "";
     }
 }
Esempio n. 27
0
        private void ShowInfo(int _id)
        {
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(_id);
            user_name = model.user_name;
            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue  = model.status.ToString();
            txtUserName.Text         = model.user_name;
            txtUserName.ReadOnly     = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text        = model.email;
            txtNickName.Text     = model.nick_name;
            txtAvatar.Text       = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text   = model.mobile;


            txtAddress.Text = model.address;
            txtAmount.Text  = model.amount.ToString();
            txtPoint.Text   = model.point.ToString();
            txtCompany.Text = model.company.ToString();
            txtExp.Text     = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text   = model.reg_ip.ToString();
            if (model.exp == 1)
            {
                cbExp.Checked = true;
            }
            try
            {
                guo  = model.area.Split(',')[0].ToString();
                area = model.area.Split(',')[1].ToString();
                city = model.area.Split(',')[2].ToString();
                zip  = model.qq;
            }
            catch (Exception eee) {}
            //查找最近登錄資訊
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text   = logModel.login_ip;
            }
        }
Esempio n. 28
0
        private void Bind()
        {
            int id = WEBUserCurrent.UserID;

            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();
            model = bll.GetModel(id);
            if (model != null)
            {
                txtusername.Text   = model.user_name;
                txtpassword.Value  = DESEncrypt.Decrypt(model.password);
                txtpassword2.Value = DESEncrypt.Decrypt(model.password);
                txtemall.Value     = model.email;
                txtName.Value      = model.nick_name;

                ViewState["file"] = model.avatar;
                //model.sex = rblSex.SelectedValue;
                //DateTime _birthday;
                //if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
                //{
                //    model.birthday = _birthday;
                //}
                txtphone.Value = model.telphone;
                //model.qq = "";
                txtAddress.Value = model.address;



                if (model.group_id == 1)
                {
                    ddlGroup.SelectedValue = "0";
                    divsj.Attributes.Add("style", "display:none");
                }
                else
                {
                    divsj.Attributes.Add("style", "display:");
                    ddlGroup.SelectedValue = "1";
                    model.group_id         = 5;
                    //dianming.Value = model.dianming;
                    //dianmiaoshu.Value = model.dianmiaoshu;
                    //congye.Value = model.congye;
                    gongsi.Value = model.gongsi;
                    //fuwuquyu.Value = model.fuwuquyu;
                    //shuxishequ.Value = model.shuxishequ;
                    //fuwutechang.Value = model.fuwutechang;
                    //jingli.Value = model.jingli;
                    //zhengshu.Value = model.zhengshu;
                    note.Value = model.note;
                }
                ddlGroup.Enabled = false;
            }
        }
Esempio n. 29
0
 /// <summary>
 /// 获取用户真实姓名
 /// </summary>
 /// <param name="user_id"></param>
 /// <returns></returns>
 protected string get_real_name(int user_id)
 {
     BLL.users   bll   = new BLL.users();
     Model.users model = bll.GetModel(user_id);
     if (model != null)
     {
         return(model.real_name);
     }
     else
     {
         return("");
     }
 }
Esempio n. 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = Common.DTRequest.GetQueryString("username");

            BLL.users bll = new BLL.users();
            if (bll.Exists(username))
            {
                Model.users model = bll.GetModel(username);
                HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] = model;
                Session.Timeout = 45;
                Response.Redirect("usercenter.aspx?action=index");
            }
        }
Esempio n. 31
0
        //登入
        protected void btnlogin_Click(object sender, ImageClickEventArgs e)
        {
            //DAL.manager bll = new DAL.manager();
            //Model.manager model = bll.GetModelVIP(txtusername.Value.Trim(), DESEncrypt.Encrypt(txtpassword.Value.Trim()));
            //if (model != null)
            //{

            //    HttpCookie ccookie1 = new HttpCookie("VIPIDS", model.id.ToString());
            //    Response.Cookies.Add(ccookie1);

            //    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('登入成功');window.location.href='viplist.aspx'</script>");
            //}
            //else
            //{
            //    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帳號或密碼錯誤')</script>");
            //}

            BLL.users bll   = new BLL.users();
            var       model = bll.GetModel(txtusername.Value.Trim(), DESEncrypt.Encrypt(txtpassword.Value.Trim()), 0, " and is_lock=0 AND isVip=1");

            if (model != null)
            {
                if (model.is_lock == 1)
                {
                    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('你的帳號還沒有通過審核!');window.location.href='login_vip.aspx'</script>");
                }
                else if (model.is_lock == 2)
                {
                    this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('你的帳號被禁用!');window.location.href='login_vip.aspx'</script>");
                }
                else
                {
                    Utils.WriteCookie("WEBUSERID", model.id.ToString(), 30);
                    Utils.WriteCookie("WEBUserNamecook", model.user_name.ToString(), 30);
                    Utils.WriteCookie("WEBRealNamecook", model.nick_name.ToString(), 30);
                    Utils.WriteCookie("WEBUserTypecook", model.group_id.ToString(), 30);
                    if (model.group_id == 5)
                    {
                        this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('登入成功');window.location.href='viplist.aspx'</script>");
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('登入成功');window.location.href='viplist.aspx'</script>");
                    }
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帳號或密碼錯誤')</script>");
            }
        }
Esempio n. 32
0
        private void Bindinfo()
        {
            Model.users User = new Model.users();

            var usermodel = bllUser.GetModel(BLL.Function.Instance.StringToNum(ids));

            Images            = "images/vip_touxiang.jpg";
            lblUsername.Text  = usermodel.user_name;
            lblbUsertype.Text = new DAL.user_groups().GetTitle(usermodel.group_id);

            //是商家會員就獲取資訊

            BindJp(1);
        }
Esempio n. 33
0
 public ActionResult Login(string name, string pwd)
 {
     if (name == "123" && pwd == "456")
     {
         BLL.users   bll   = new BLL.users();
         Model.users model = bll.GetModel(1);
         Session[DTKeys.SESSION_USER_INFO] = model;
         Session.Timeout = 45;
         Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name, 43200);
         Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password, 43200);
         return(RedirectToAction("center", "User"));
     }
     return(Content("{\"status\": 0, \"msg\": \"温馨提示:请输入用户名或密码!\"}"));
 }
Esempio n. 34
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            BLL.users userService = new BLL.users();
            string userName = txtUserName.Text.Trim();
            string password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt"));
            //string password = txtPassword.Text.Trim();
            DataTable userList = userService.GetList("userName='******' and password='******' and roleId in (4,10,11)").Tables[0];
            if (userList.Rows.Count > 0)
            {

                if (userList.Rows[0]["status"].ToString() == "0")
                {
                    MessageBox.Show(this, "此用户名已被冻结,无法登陆!");
                    return;
                }
                //写入Cookie
                try
                {
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserId, 2, userList.Rows[0]["userId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserName, 2, txtUserName.Text.Trim());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_TrueName, 2, DESEncrypt.Encrypt(userList.Rows[0]["trueName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleId, 2, userList.Rows[0]["roleId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleName, 2, DESEncrypt.Encrypt(userList.Rows[0]["roleName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_DeptId, 2, userList.Rows[0]["deptId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_IsAdmin, 2, userList.Rows[0]["isAdmin"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_Avatar, 2, userList.Rows[0]["avatar_small"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_LastLoginTime, 2, DateTime.Parse(userList.Rows[0]["lastLoginTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                catch
                {
                    //Session["userName"] = txtUserName.Text.Trim();
                    //Session["userType"] = ddrUserTyp.SelectedValue;
                    //Session["orgId"] = userList.Rows[0]["orgId"].ToString();
                }
                //更新最后登陆时间
                Model.users userModel = userService.GetModel(int.Parse(userList.Rows[0]["userId"].ToString()));
                userModel.lastLoginTime = DateTime.Now;
                userService.Update(userModel);

                Response.Redirect("index.aspx");
                //MessageBox.ShowAndRedirect(this, "登录成功!", "index.html");
            }
            else
            {
                MessageBox.Show(this, "用户名或密码错误!");
            }
        }
Esempio n. 35
0
        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtMsn.Text = model.msn;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
Esempio n. 36
0
        //发送手机短信
        protected void btnSmsPost_Click(object sender, EventArgs e)
        {
            BLL.users bll = new BLL.users();
            StringBuilder str = new StringBuilder();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.users model = bll.GetModel(id);
                    if (model != null && !string.IsNullOrEmpty(model.mobile))
                    {
                        str.Append(model.mobile + ",");
                    }
                }
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                Response.Redirect("user_sms.aspx?mobiles=" + Utils.UrlEncode(Utils.DelLastComma(str.ToString())));
            }
        }
Esempio n. 37
0
        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblIsLock.SelectedValue = model.is_lock.ToString();
            txtUserName.Enabled = false;
            txtUserName.Text = model.user_name;
            hidUserName.Value = model.user_name;
            txtPassword.Attributes["value"] = model.password;
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
Esempio n. 38
0
        private void user_oauth_register(HttpContext context)
        {
            //检查URL参数
            if (context.Session["oauth_name"] == null)
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}");
                return;
            }
            //获取授权信息
            string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
            if (result.Contains("error"))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}");
                return;
            }
            //反序列化JSON
            Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
            if (dic["ret"].ToString() != "0")
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}");
                return;
            }

            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = DTRequest.GetFormString("txtEmail").Trim();
            string userip = DTRequest.GetIP();
            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
                return;
            }
            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = bll.GetRandomName(10);
            model.password = DESEncrypt.Encrypt(password);
            model.email = email;
            if (!string.IsNullOrEmpty(dic["nick"].ToString()))
            {
                model.nick_name = dic["nick"].ToString();
            }
            if (dic["avatar"].ToString().StartsWith("http://"))
            {
                model.avatar = dic["avatar"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["sex"].ToString()))
            {
                model.sex = dic["sex"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["birthday"].ToString()))
            {
                model.birthday = DateTime.Parse(dic["birthday"].ToString());
            }
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.is_lock = 0; //设置为对应状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分");
            }
            if (modelGroup.amount > 0)
            {
                new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }
            //判断是否发送站内短消息
            if (userConfig.regmsgstatus == 1)
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            //绑定到对应的授权类型
            Model.user_oauth oauthModel = new Model.user_oauth();
            oauthModel.oauth_name = dic["oauth_name"].ToString();
            oauthModel.user_id = model.id;
            oauthModel.user_name = model.user_name;
            oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
            oauthModel.oauth_openid = dic["oauth_openid"].ToString();
            new BLL.user_oauth().Add(oauthModel);

            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态,防止Session提前过期
            Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
            Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Esempio n. 39
0
        private void user_login(HttpContext context)
        {
            string username = DTRequest.GetFormString("txtUserName");
            string password = DTRequest.GetFormString("txtPassword");
            string remember = DTRequest.GetFormString("chkRemember");
            //检查用户名密码
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }

            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, DESEncrypt.Encrypt(password), userConfig.emaillogin);
            if (model == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //检查用户是否通过验证
            if (model.is_lock == 1) //待验证
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msgbox\":\"会员尚未通过验证!\"}");
                return;
            }
            else if (model.is_lock == 2) //待审核
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msgbox\":\"会员尚未通过审核!\"}");
                return;
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态下次自动登录
            if (remember.ToLower() == "true")
            {
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name, 43200);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password, 43200);
            }
            else
            {
                //防止Session提前过期
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            }

            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Esempio n. 40
0
        private void user_oauth_bind(HttpContext context)
        {
            //检查URL参数
            if (context.Session["oauth_name"] == null)
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}");
                return;
            }
            //获取授权信息
            string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
            if (result.Contains("error"))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}");
                return;
            }
            //反序列化JSON
            Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
            if (dic["ret"].ToString() != "0")
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + ",描述:" + dic["msg"] + "\"}");
                return;
            }

            //检查用户名密码
            string username = DTRequest.GetString("txtUserName");
            string password = DTRequest.GetString("txtPassword");
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, DESEncrypt.Encrypt(password), userConfig.emaillogin);
            if (model == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //开始绑定
            Model.user_oauth oauthModel = new Model.user_oauth();
            oauthModel.oauth_name = dic["oauth_name"].ToString();
            oauthModel.user_id = model.id;
            oauthModel.user_name = model.user_name;
            oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
            oauthModel.oauth_openid = dic["oauth_openid"].ToString();
            int newId = new BLL.user_oauth().Add(oauthModel);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:绑定过程中出现错误,请重新登录授权!\"}");
                return;
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态,防止Session提前过期
            Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
            Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Esempio n. 41
0
        private void user_repassword(HttpContext context)
        {
            string code = context.Request.Form["txtCode"];
            string strcode = context.Request.Form["hideCode"];
            string password = context.Request.Form["txtPassword"];

            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查验证字符串
            if (string.IsNullOrEmpty(strcode))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统找不到邮件验证的字符串!\"}");
                return;
            }
            //检查输入的新密码
            if (string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的新密码!\"}");
                return;
            }

            BLL.user_code codeBll = new BLL.user_code();
            Model.user_code codeModel = codeBll.GetModel(strcode);
            if (codeModel == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件验证的字符串不存在或已过期!\"}");
                return;
            }
            //验证用户是否存在
            BLL.users userBll = new BLL.users();
            if (!userBll.Exists(codeModel.user_id))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户不存在或已被删除!\"}");
                return;
            }
            Model.users userModel = userBll.GetModel(codeModel.user_id);
            //执行修改操作
            userModel.password = DESEncrypt.Encrypt(password);
            userBll.Update(userModel);
            //更改验证字符串状态
            codeModel.count = 1;
            codeModel.status = 1;
            codeBll.Update(codeModel);
            context.Response.Write("{\"msg\":1, \"msgbox\":\"修改密码成功,请记住您的新密码!\"}");
            return;
        }
Esempio n. 42
0
 private void user_getpassword(HttpContext context)
 {
     string code = DTRequest.GetFormString("txtCode");
     string username = DTRequest.GetFormString("txtUserName").Trim();
     //检查用户名是否正确
     if (string.IsNullOrEmpty(username))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户名不可为空!\"}");
         return;
     }
     //校检验证码
     string result = verify_code(context, code);
     if (result != "success")
     {
         context.Response.Write(result);
         return;
     }
     //检查用户信息
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(username);
     if (model == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您输入的用户名不存在!\"}");
         return;
     }
     if (string.IsNullOrEmpty(model.email))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"您尚未设置邮箱地址,无法使用取回密码功能!\"}");
         return;
     }
     //生成随机码
     string strcode = Utils.GetCheckCode(20);
     //获得邮件内容
     Model.mail_template mailModel = new BLL.mail_template().GetModel("getpassword");
     if (mailModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件发送失败,邮件模板内容不存在!\"}");
         return;
     }
     //检查是否重复提交
     BLL.user_code codeBll = new BLL.user_code();
     Model.user_code codeModel;
     codeModel = codeBll.GetModel(username, DTEnums.CodeEnum.RegVerify.ToString());
     if (codeModel == null)
     {
         codeModel = new Model.user_code();
         //写入数据库
         codeModel.user_id = model.id;
         codeModel.user_name = model.user_name;
         codeModel.type = DTEnums.CodeEnum.Password.ToString();
         codeModel.str_code = strcode;
         codeModel.eff_time = DateTime.Now.AddDays(1);
         codeModel.add_time = DateTime.Now;
         codeBll.Add(codeModel);
     }
     //替换模板内容
     string titletxt = mailModel.maill_title;
     string bodytxt = mailModel.content;
     titletxt = titletxt.Replace("{webname}", siteConfig.webname);
     titletxt = titletxt.Replace("{username}", model.user_name);
     bodytxt = bodytxt.Replace("{webname}", siteConfig.webname);
     bodytxt = bodytxt.Replace("{username}", model.user_name);
     bodytxt = bodytxt.Replace("{linkurl}", Utils.DelLastChar(siteConfig.weburl, "/") + new BasePage().linkurl("repassword1", "reset", strcode)); //此处需要修改
     //发送邮件
     try
     {
         DTMail.sendMail(siteConfig.emailstmp,
             siteConfig.emailusername,
             DESEncrypt.Decrypt(siteConfig.emailpassword),
             siteConfig.emailnickname,
             siteConfig.emailfrom,
             model.email,
             titletxt, bodytxt);
     }
     catch
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件发送失败,请联系本站管理员!\"}");
         return;
     }
     context.Response.Write("{\"msg\":1, \"msgbox\":\"邮件发送成功,请登录您的邮箱找回登录密码!\"}");
     return;
 }
Esempio n. 43
0
        private void user_repassword(HttpContext context)
        {
            string strcode = DTRequest.GetFormString("hideCode"); //取回密码字符串
            string password = DTRequest.GetFormString("txtPassword"); //重设后的密码

            //检查验证字符串
            if (string.IsNullOrEmpty(strcode))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码字符串不能为空!\"}");
                return;
            }
            //检查输入的新密码
            if (string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入您的新密码!\"}");
                return;
            }

            BLL.user_code codeBll = new BLL.user_code();
            Model.user_code codeModel = codeBll.GetModel(strcode);
            if (codeModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,校检码不存在或已过期!\"}");
                return;
            }
            //验证用户是否存在
            BLL.users userBll = new BLL.users();
            if (!userBll.Exists(codeModel.user_id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户不存在或已被删除!\"}");
                return;
            }
            Model.users userModel = userBll.GetModel(codeModel.user_id);
            //执行修改操作
            userModel.password = DESEncrypt.Encrypt(password, userModel.salt);
            userBll.Update(userModel);
            //更改验证字符串状态
            codeModel.count = 1;
            codeModel.status = 1;
            codeBll.Update(codeModel);
            context.Response.Write("{\"status\":1, \"msg\":\"修改密码成功,请记住新密码!\"}");
            return;
        }
Esempio n. 44
0
        private void user_register(HttpContext context)
        {
            string code = DTRequest.GetFormString("txtCode").Trim();
            string invitecode = DTRequest.GetFormString("txtInviteCode").Trim();
            string username = DTRequest.GetFormString("txtUserName").Trim();
            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = DTRequest.GetFormString("txtEmail").Trim();
            string userip = DTRequest.GetIP();

            #region 检查各项并提示
            //检查是否开启会员功能
            if (siteConfig.memberstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,会员功能已被关闭,无法注册新会员!\"}");
                return;
            }
            if (userConfig.regstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统暂不允许注册新用户!\"}");
                return;
            }
            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查用户输入信息是否为空
            if (username == "" || password == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"用户名和密码不能为空!\"}");
                return;
            }
            if (email == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"电子邮箱不能为空!\"}");
                return;
            }

            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            if (bll.Exists(username))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户名已经存在!\"}");
                return;
            }
            //检查同一IP注册时隔
            if (userConfig.regctrl > 0)
            {
                if (bll.Exists(userip, userConfig.regctrl))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,同一IP在" + userConfig.regctrl + "小时内不能注册多个用户!\"}");
                    return;
                }
            }
            //不允许同一Email注册不同用户
            if (userConfig.regemailditto == 0)
            {
                if (bll.ExistsEmail(email))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"Email不允许重复注册,如果你忘记用户名,请找回密码!\"}");
                    return;
                }
            }
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
                return;
            }
            //检查是否通过邀请码注册
            if (userConfig.regstatus == 2)
            {
                string result1 = verify_invite_reg(username, invitecode);
                if (result1 != "success")
                {
                    context.Response.Write(result1);
                    return;
                }
            }
            #endregion

            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = username;
            model.password = DESEncrypt.Encrypt(password);
            model.email = email;
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.is_lock = userConfig.regverify; //设置为对应状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分");
            }
            if (modelGroup.amount > 0)
            {
                new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }
            //判断是否发送站内短消息
            if (userConfig.regmsgstatus == 1)
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            //需要Email验证
            if (userConfig.regverify == 1)
            {
                string result2 = verify_email(model);
                if (result2 != "success")
                {
                    context.Response.Write(result2);
                    return;
                }
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msgbox\":\"注册成功,请进入邮箱验证激活账户!\"}");
            }
            //需要人工审核
            else if (userConfig.regverify == 2)
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msgbox\":\"注册成功,请等待审核通过!\"}");
            }
            else
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=succeed&username="******"\", \"msgbox\":\"恭喜您,注册成功啦!\"}");
            }
            return;
        }
Esempio n. 45
0
        private void user_register(HttpContext context)
        {
            string code = DTRequest.GetFormString("txtCode").Trim();
            string invitecode = DTRequest.GetFormString("txtInviteCode").Trim();
            string username = Utils.ToHtml(DTRequest.GetFormString("txtUserName").Trim());
            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim());
            string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim());
            string userip = DTRequest.GetIP();

            #region 检查各项并提示
            //检查是否开启会员功能
            if (siteConfig.memberstatus == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,会员功能已关闭,无法注册!\"}");
                return;
            }
            if (userConfig.regstatus == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,系统暂不允许注册新用户!\"}");
                return;
            }
            //校检验证码,如果注册使用手机短信则只需验证手机验证码,否则使用网页验证码
            if (userConfig.regstatus == 2) //手机验证码
            {
                string result = verify_sms_code(context, code);
                if (result != "success")
                {
                    context.Response.Write(result);
                    return;
                }
            }
            else //网页验证码
            {
                string result = verify_code(context, code);
                if (result != "success")
                {
                    context.Response.Write(result);
                    return;
                }
            }
            //检查用户输入信息是否为空
            if (username == "" || password == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"错误:用户名和密码不能为空!\"}");
                return;
            }
            if (userConfig.regemailditto == 0 && email == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"错误:电子邮箱不能为空!\"}");
                return;
            }
            if (userConfig.mobilelogin == 1 && mobile == "")
            {
                context.Response.Write("{\"status\":0, \"msg\":\"错误:手机号码不能为空!\"}");
                return;
            }

            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            if (bll.Exists(username))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,该用户名已经存在!\"}");
                return;
            }
            //检查同一IP注册时隔
            if (userConfig.regctrl > 0)
            {
                if (bll.Exists(userip, userConfig.regctrl))
                {
                    context.Response.Write("{\"status\":0, \"msg\":\"对不起,同IP在" + userConfig.regctrl + "小时内禁止重复注册!\"}");
                    return;
                }
            }
            //不允许同一Email注册不同用户
            if (userConfig.regemailditto == 0 || userConfig.emaillogin == 1)
            {
                if (bll.ExistsEmail(email))
                {
                    context.Response.Write("{\"status\":0, \"msg\":\"对不起,该邮箱已被注册!\"}");
                    return;
                }
            }
            //不允许同一手机号码注册不同用户
            if (userConfig.mobilelogin == 1)
            {
                if (bll.ExistsMobile(mobile))
                {
                    context.Response.Write("{\"status\":0, \"msg\":\"对不起,该手机号码已被注册!\"}");
                    return;
                }
            }
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系网站管理员!\"}");
                return;
            }
            //检查是否通过邀请码注册
            if (userConfig.regstatus == 2)
            {
                string result1 = verify_invite_reg(username, invitecode);
                if (result1 != "success")
                {
                    context.Response.Write(result1);
                    return;
                }
            }
            #endregion

            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = username;
            model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串
            model.password = DESEncrypt.Encrypt(password, model.salt);
            model.email = email;
            model.mobile = mobile;
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            //设置对应的状态
            switch (userConfig.regverify)
            {
                case 0:
                    model.status = 0; //正常
                    break;
                case 3:
                    model.status = 2; //人工审核
                    break;
                default:
                    model.status = 1; //待验证
                    break;
            }
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"系统故障,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false);
            }
            if (modelGroup.amount > 0)
            {
                new BLL.user_amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }

            #region 判断是否发送欢迎消息
            if (userConfig.regmsgstatus == 1) //站内短消息
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            else if (userConfig.regmsgstatus == 2) //发送邮件
            {
                //取得邮件模板内容
                Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg");
                if (mailModel != null)
                {
                    //替换标签
                    string mailTitle = mailModel.maill_title;
                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                    string mailContent = mailModel.content;
                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                    mailContent = mailContent.Replace("{username}", model.user_name);
                    //发送邮件
                    DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                        siteConfig.emailfrom, model.email, mailTitle, mailContent);
                }
            }
            else if (userConfig.regmsgstatus == 3 && mobile != "") //发送短信
            {
                Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容
                if (smsModel != null)
                {
                    //替换标签
                    string msgContent = smsModel.content;
                    msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                    msgContent = msgContent.Replace("{weburl}", siteConfig.weburl);
                    msgContent = msgContent.Replace("{webtel}", siteConfig.webtel);
                    msgContent = msgContent.Replace("{username}", model.user_name);
                    //发送短信
                    string tipMsg = string.Empty;
                    new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                }
            }
            #endregion

            //需要Email验证
            if (userConfig.regverify == 1)
            {
                string result2 = verify_email(model);
                if (result2 != "success")
                {
                    context.Response.Write(result2);
                    return;
                }
                context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msg\":\"注册成功,请进入邮箱验证激活账户!\"}");
            }
            //手机短信验证
            else if (userConfig.regverify == 2)
            {
                string result3 = verify_mobile(model);
                if (result3 != "success")
                {
                    context.Response.Write(result3);
                    return;
                }
                context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendsms&username="******"\", \"msg\":\"注册成功,请查收短信验证激活账户!\"}");
            }
            //需要人工审核
            else if (userConfig.regverify == 3)
            {
                context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msg\":\"注册成功,请等待审核通过!\"}");
            }
            else
            {
                context.Session[DTKeys.SESSION_USER_INFO] = model;
                context.Session.Timeout = 45;

                //防止Session提前过期
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);

                //写入登录日志
                new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");

                context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=succeed&username="******"\", \"msg\":\"注册成功,欢迎成为本站会员!\"}");
            }
            return;
        }
Esempio n. 46
0
        private void user_status(HttpContext context)
        {
            int id = DTRequest.GetQueryInt("id");
            int status = DTRequest.GetQueryInt("status");
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(id);
            Model.users users = new BasePage().GetUserInfo();
            if (users == null)
            {

                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
                return;
            }
            model.status = status;
            if (bll.Update(model))
            {
                context.Response.Write("{\"status\":1, \"msg\":\"用户状态更改!\"}");
                return;
            }
        }
Esempio n. 47
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            if (txtPassword.Text.Trim() != model.password)
            {
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim());
            }
            model.email = txtEmail.Text;
            model.nick_name = txtNickName.Text;
            model.avatar = txtAvatar.Text;
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = txtTelphone.Text.Trim();
            model.mobile = txtMobile.Text.Trim();
            model.qq = txtQQ.Text;
            model.address = txtAddress.Text.Trim();
            model.amount = decimal.Parse(txtAmount.Text.Trim());
            model.point = int.Parse(txtPoint.Text.Trim());
            model.exp = int.Parse(txtExp.Text.Trim());

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
Esempio n. 48
0
        private void user_oauth_register(HttpContext context)
        {
            //检查URL参数
            if (context.Session["oauth_name"] == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:授权参数不正确!\"}");
                return;
            }
            //获取授权信息
            string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
            if (result.Contains("error"))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:请检查URL是否正确!\"}");
                return;
            }
            //反序列化JSON
            Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
            if (dic["ret"].ToString() != "0")
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}");
                return;
            }

            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = Utils.ToHtml(DTRequest.GetFormString("txtEmail").Trim());
            string mobile = Utils.ToHtml(DTRequest.GetFormString("txtMobile").Trim());
            string userip = DTRequest.GetIP();

            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"用户尚未分组,请联系管理员!\"}");
                return;
            }
            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = bll.GetRandomName(10); //随机用户名
            model.salt = Utils.GetCheckCode(6); //获得6位的salt加密字符串
            model.password = DESEncrypt.Encrypt(password, model.salt);
            model.email = email;
            model.mobile = mobile;
            if (!string.IsNullOrEmpty(dic["nick"].ToString()))
            {
                model.nick_name = dic["nick"].ToString();
            }
            if (dic["avatar"].ToString().StartsWith("http://"))
            {
                model.avatar = dic["avatar"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["sex"].ToString()))
            {
                model.sex = dic["sex"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["birthday"].ToString()))
            {
                model.birthday = Utils.StrToDateTime(dic["birthday"].ToString());
            }
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.status = 0; //设置为正常状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.user_point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分", false);
            }
            if (modelGroup.amount > 0)
            {
                new BLL.user_amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }
            //判断是否发送欢迎消息
            if (userConfig.regmsgstatus == 1) //站内短消息
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            else if (userConfig.regmsgstatus == 2) //发送邮件
            {
                //取得邮件模板内容
                Model.mail_template mailModel = new BLL.mail_template().GetModel("welcomemsg");
                if (mailModel != null)
                {
                    //替换标签
                    string mailTitle = mailModel.maill_title;
                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                    string mailContent = mailModel.content;
                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                    mailContent = mailContent.Replace("{username}", model.user_name);
                    //发送邮件
                    DTMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                        siteConfig.emailfrom, model.email, mailTitle, mailContent);
                }
            }
            else if (userConfig.regmsgstatus == 3 && mobile != "") //发送短信
            {
                Model.sms_template smsModel = new BLL.sms_template().GetModel("welcomemsg"); //取得短信内容
                if (smsModel != null)
                {
                    //替换标签
                    string msgContent = smsModel.content;
                    msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                    msgContent = msgContent.Replace("{weburl}", siteConfig.weburl);
                    msgContent = msgContent.Replace("{webtel}", siteConfig.webtel);
                    msgContent = msgContent.Replace("{username}", model.user_name);
                    //发送短信
                    string tipMsg = string.Empty;
                    new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                }
            }
            //绑定到对应的授权类型
            Model.user_oauth oauthModel = new Model.user_oauth();
            oauthModel.oauth_name = dic["oauth_name"].ToString();
            oauthModel.user_id = model.id;
            oauthModel.user_name = model.user_name;
            oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
            oauthModel.oauth_openid = dic["oauth_openid"].ToString();
            new BLL.user_oauth().Add(oauthModel);

            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态,防止Session提前过期
            Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
            Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
            //返回URL
            context.Response.Write("{\"status\":1, \"msg\":\"会员登录成功!\"}");
            return;
        }
Esempio n. 49
0
        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }

            rb_user_type.SelectedValue = model.user_type.ToString();

            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }

            ddl_province.SelectedValue = model.province.ToString();
            ddl_city.Items.Add(new ListItem("请选择市...", "0"));
            if (Convert.ToInt32(ddl_province.SelectedValue) > 0)
            {
                BLL.city bll_city = new BLL.city();
                DataTable dt = bll_city.GetList("ProvinceID=" + ddl_province.SelectedValue).Tables[0];

                foreach (DataRow dr in dt.Rows)
                {
                    ddl_city.Items.Add(new ListItem(dr["CityName"].ToString(), dr["CityID"].ToString()));
                }
                ddl_city.SelectedValue = model.city.ToString();
            }
            ddl_district.Items.Add(new ListItem("请选择区/县...", "0"));
            if (Convert.ToInt32(ddl_city.SelectedValue) > 0)
            {
                BLL.district bll_district = new BLL.district();
                ddl_district.Items.Clear();
                DataTable dt = bll_district.GetList("CityID=" + ddl_province.SelectedValue).Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    ddl_district.Items.Add(new ListItem(dr["DistrictName"].ToString(), dr["DistrictID"].ToString()));
                }
                ddl_district.SelectedValue = model.district.ToString();
            }
        }
Esempio n. 50
0
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status = int.Parse(rblStatus.SelectedValue);
            //判断密码是否更改
            if (txtPassword.Text.Trim() != defaultpassword)
            {
                //获取用户已生成的salt作为密钥加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.email = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar = Utils.DropHTML(txtAvatar.Text);
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile = Utils.DropHTML(txtMobile.Text.Trim());
            model.qq = Utils.DropHTML(txtQQ.Text);
            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.point = Utils.StrToInt(txtPoint.Text.Trim(), 0);
            model.exp = Utils.StrToInt(txtExp.Text.Trim(), 0);
            model.user_type = Convert.ToInt32(rb_user_type.SelectedValue);
            model.province = Convert.ToInt32(ddl_province.SelectedValue);
            model.city = Convert.ToInt32(ddl_city.SelectedValue);
            model.district = Convert.ToInt32(ddl_district.SelectedValue);

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }
Esempio n. 51
0
 private void user_getpassword(HttpContext context)
 {
     string site = DTRequest.GetQueryString("site");
     string code = DTRequest.GetFormString("txtCode");
     string type = DTRequest.GetFormString("txtType");
     string username = DTRequest.GetFormString("txtUserName").Trim();
     //检查站点目录
     if (string.IsNullOrEmpty(site))
     {
         context.Response.Write("{\"status\":0, \"msg\":\"对不起,网站传输参数有误!\"}");
         return;
     }
     //检查用户名
     if (string.IsNullOrEmpty(username))
     {
         context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户名不可为空!\"}");
         return;
     }
     //检查取回密码类型
     if (string.IsNullOrEmpty(type))
     {
         context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择取回密码类型!\"}");
         return;
     }
     //校检验证码
     string result = verify_code(context, code);
     if (result != "success")
     {
         context.Response.Write(result);
         return;
     }
     //检查用户信息
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(username);
     if (model == null)
     {
         context.Response.Write("{\"status\":0, \"msg\":\"对不起,您输入的用户名不存在!\"}");
         return;
     }
     //发送取回密码的短信或邮件
     if (type.ToLower() == "mobile") //使用手机取回密码
     {
         #region 发送短信==================
         if (string.IsNullOrEmpty(model.mobile))
         {
             context.Response.Write("{\"status\":0, \"msg\":\"您尚未绑定手机号码,无法取回密码!\"}");
             return;
         }
         Model.sms_template smsModel = new BLL.sms_template().GetModel("usercode"); //取得短信内容
         if (smsModel == null)
         {
             context.Response.Write("{\"status\":0, \"msg\":\"发送失败,短信模板不存在,请联系管理员!\"}");
         }
         string strcode = Utils.Number(4); //随机验证码
         //检查是否重复提交
         BLL.user_code codeBll = new BLL.user_code();
         Model.user_code codeModel;
         codeModel = codeBll.GetModel(username, DTEnums.CodeEnum.RegVerify.ToString(), "d");
         if (codeModel == null)
         {
             codeModel = new Model.user_code();
             //写入数据库
             codeModel.user_id = model.id;
             codeModel.user_name = model.user_name;
             codeModel.type = DTEnums.CodeEnum.Password.ToString();
             codeModel.str_code = strcode;
             codeModel.eff_time = DateTime.Now.AddMinutes(userConfig.regsmsexpired);
             codeModel.add_time = DateTime.Now;
             codeBll.Add(codeModel);
         }
         //替换标签
         string msgContent = smsModel.content;
         msgContent = msgContent.Replace("{webname}", siteConfig.webname);
         msgContent = msgContent.Replace("{weburl}", siteConfig.weburl);
         msgContent = msgContent.Replace("{webtel}", siteConfig.webtel);
         msgContent = msgContent.Replace("{code}", codeModel.str_code);
         msgContent = msgContent.Replace("{valid}", userConfig.regsmsexpired.ToString());
         //发送短信
         string tipMsg = string.Empty;
         bool result1 = new BLL.sms_message().Send(model.mobile, msgContent, 1, out tipMsg);
         if (!result1)
         {
             context.Response.Write("{\"status\":0, \"msg\":\"发送失败," + tipMsg + "\"}");
             return;
         }
         context.Response.Write("{\"status\":1, \"msg\":\"手机验证码发送成功!\", \"url\":\""
             + new BasePage().getlink(site, new BasePage().linkurl("repassword", "?action=mobile&username="******"\"}");
         return;
         #endregion
     }
     else if (type.ToLower() == "email") //使用邮箱取回密码
     {
         #region 发送邮件==================
         if (string.IsNullOrEmpty(model.email))
         {
             context.Response.Write("{\"status\":0, \"msg\":\"您尚未绑定邮箱,无法取回密码!\"}");
             return;
         }
         //生成随机码
         string strcode = Utils.GetCheckCode(20);
         //获得邮件内容
         Model.mail_template mailModel = new BLL.mail_template().GetModel("getpassword");
         if (mailModel == null)
         {
             context.Response.Write("{\"status\":0, \"msg\":\"邮件发送失败,邮件模板内容不存在!\"}");
             return;
         }
         //检查是否重复提交
         BLL.user_code codeBll = new BLL.user_code();
         Model.user_code codeModel;
         codeModel = codeBll.GetModel(username, DTEnums.CodeEnum.RegVerify.ToString(), "d");
         if (codeModel == null)
         {
             codeModel = new Model.user_code();
             //写入数据库
             codeModel.user_id = model.id;
             codeModel.user_name = model.user_name;
             codeModel.type = DTEnums.CodeEnum.Password.ToString();
             codeModel.str_code = strcode;
             codeModel.eff_time = DateTime.Now.AddDays(userConfig.regemailexpired);
             codeModel.add_time = DateTime.Now;
             codeBll.Add(codeModel);
         }
         //替换模板内容
         string titletxt = mailModel.maill_title;
         string bodytxt = mailModel.content;
         titletxt = titletxt.Replace("{webname}", siteConfig.webname);
         titletxt = titletxt.Replace("{username}", model.user_name);
         bodytxt = bodytxt.Replace("{webname}", siteConfig.webname);
         bodytxt = bodytxt.Replace("{weburl}", siteConfig.weburl);
         bodytxt = bodytxt.Replace("{webtel}", siteConfig.webtel);
         bodytxt = bodytxt.Replace("{valid}", userConfig.regemailexpired.ToString());
         bodytxt = bodytxt.Replace("{username}", model.user_name);
         bodytxt = bodytxt.Replace("{linkurl}", "http://" + HttpContext.Current.Request.Url.Authority.ToLower()
             + new BasePage().getlink(site, new BasePage().linkurl("repassword", "?action=email&code=" + codeModel.str_code)));
         //发送邮件
         try
         {
             DTMail.sendMail(siteConfig.emailsmtp,
                 siteConfig.emailssl,
                 siteConfig.emailusername,
                 DESEncrypt.Decrypt(siteConfig.emailpassword),
                 siteConfig.emailnickname,
                 siteConfig.emailfrom,
                 model.email,
                 titletxt, bodytxt);
         }
         catch
         {
             context.Response.Write("{\"status\":0, \"msg\":\"邮件发送失败,请联系本站管理员!\"}");
             return;
         }
         context.Response.Write("{\"status\":1, \"msg\":\"邮件发送成功,请登录邮箱查看邮件!\"}");
         return;
         #endregion
     }
     context.Response.Write("{\"status\":0, \"msg\":\"发生未知错误,请检查参数是否正确!\"}");
     return;
 }
        private void redpacket_info(HttpContext context)
        {
            string unique_code = DTRequest.GetQueryString("code");
            StringBuilder sb = new StringBuilder();
            if (string.IsNullOrEmpty(unique_code) || unique_code == "unsafe string")
            {
                sb.Append("  <dl><dt></dt><dd>消费码不能为空!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            BLL.redpacket bll_redpacket = new BLL.redpacket();
            int count = 0;
            DataSet ds_redpacket = bll_redpacket.GetRedPacketList_WebService(1, 1, "unique_code='" + unique_code + "'", "status desc", out count);
            if (ds_redpacket == null || count == 0)
            {
                sb.Append("  <dl><dt></dt><dd>此消费码不存在,验证无效!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }
            DataTable dt_redpacket = ds_redpacket.Tables[0];

            BLL.users bll_user = new BLL.users();
            Model.users model_user = bll_user.GetModel(int.Parse(dt_redpacket.Rows[0]["guid_id"].ToString()));
            if (model_user == null)
            {
                sb.Append("  <dl><dt></dt><dd>数据异常,请联系管理员!</dd></dl>");
                context.Response.Write(sb.ToString());
                return;
            }

            sb.Append("  <dl><dt></dt><dd>红包名称:" + dt_redpacket.Rows[0]["title"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>红包状态:" + GetUserStatus(int.Parse(dt_redpacket.Rows[0]["status"].ToString())) + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>有效期:" + dt_redpacket.Rows[0]["start_date"] + "至" + dt_redpacket.Rows[0]["end_date"] + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>会员名:" + model_user.user_name + " (昵称:" + model_user.nick_name + ")</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>工种:" + (model_user.work_type == 1 ? "领队" : "导游") + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>手机号:" + model_user.mobile + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>导游证号:" + model_user.guid_card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>身份证号:" + model_user.card + "</dd></dl>");
            sb.Append("  <dl><dt></dt><dd>申请时间:" + dt_redpacket.Rows[0]["apply_time"] + "</dd></dl>");

            context.Response.Write(sb.ToString());
            return;
        }
Esempio n. 53
0
        /// <summary>
        /// 分配账户修改资料
        /// </summary>
        /// <param name="context"></param>
        private void edit_dealing_users(HttpContext context)
        {
            int id = DTRequest.GetQueryInt("id");
            string password = DTRequest.GetString("psd");
            string phone = DTRequest.GetString("phone");
            string email = DTRequest.GetString("email");
            string real_name = DTRequest.GetString("real_name");
            int branch = DTRequest.GetFormInt("branch_id");

            BLL.users bll = new BLL.users();
            Model.users model1 = new BasePage().GetUserInfo();
            if (model1 == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
                return;
            }
            Model.users model = bll.GetModel(id);

            string psd = DESEncrypt.Encrypt(password, model1.salt);
            model.password = psd;
            model.telphone = phone;
            model.real_name = real_name;
            model.email = email;
            model.branch_id = branch;
            model.user_status = 3;
            model.user_type = 1;
            model.parent_id = model1.id;
            model.group_id = 1;
            if (bll.Update(model))
            {
                context.Response.Write("{\"status\":1, \"msg\":\"修改员工资料成功!\"}");
                return;

            }
            else
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,修改员工资料失败!\"}");
                return;

            }
        }
Esempio n. 54
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            if (txtPassword.Text.Trim() != model.password)
            {
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim());
            }
            model.email = txtEmail.Text;
            model.nick_name = txtNickName.Text;
            model.avatar = txtAvatar.Text;
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = txtTelphone.Text.Trim();
            model.mobile = txtMobile.Text.Trim();
            model.qq = txtQQ.Text;
            model.address = txtAddress.Text.Trim();
            model.amount = decimal.Parse(txtAmount.Text.Trim());
            model.point = int.Parse(txtPoint.Text.Trim());
            model.exp = 0; //int.Parse(txtExp.Text.Trim());
            model.reg_equ = txtRegEqu.Text.Trim();
            model.guid_card = txtGuidCard.Text.Trim();
            model.card = txtCard.Text.Trim();
            model.age = int.Parse(txtAge.Text.Trim());
            model.work_type = int.Parse(rblWorkType.SelectedValue);
            model.description = Utils.ToHtml(txtContent.Text.Trim());
            model.work_age = ddlWorkAge.SelectedValue.ToString();
            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
Esempio n. 55
0
        private void user_login(HttpContext context)
        {
            string sitepath = DTRequest.GetQueryString("site");
            string username = DTRequest.GetFormString("txtUserName");
            string password = DTRequest.GetFormString("txtPassword");
            string remember = DTRequest.GetFormString("chkRemember");
            //检查站点目录
            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:站点传输参数不正确!\"}");
                return;
            }
            //检查用户名密码
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }

            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, password, userConfig.emaillogin, userConfig.mobilelogin, true);
            if (model == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //检查用户是否通过验证
            if (model.status == 1) //待验证
            {
                if (userConfig.regverify == 1)
                {
                    context.Response.Write("{\"status\":1, \"url\":\""
                        + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=sendmail&username="******"\", \"msg\":\"会员尚未通过验证!\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":1, \"url\":\"" +
                        new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=sendsms&username="******"\", \"msg\":\"会员尚未通过验证!\"}");
                }
                return;
            }
            else if (model.status == 2) //待审核
            {
                context.Response.Write("{\"status\":1, \"url\":\""
                    + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("register", "?action=verify&username="******"\", \"msg\":\"会员尚未通过审核!\"}");
                return;
            }
            //检查用户每天登录是否获得积分
            if (!new BLL.user_login_log().ExistsDay(model.user_name) && userConfig.pointloginnum > 0)
            {
                new BLL.user_point_log().Add(model.id, model.user_name, userConfig.pointloginnum, "每天登录获得积分", true); //增加用户登录积分
                model = bll.GetModel(username, password, userConfig.emaillogin, userConfig.mobilelogin, true); //更新一下用户信息
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态下次自动登录
            if (remember.ToLower() == "true")
            {
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name, 43200);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password, 43200);
            }
            else
            {
                //防止Session提前过期
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            }

            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
            //返回URL
            context.Response.Write("{\"status\":1, \"msg\":\"会员登录成功!\"}");
            return;
        }