Esempio n. 1
0
        protected void save_ok(object sender, EventArgs e)
        {
            string _uName = this.txtUserName.Text;

            JumboECMS.DAL.Normal_UserDAL      _User      = new JumboECMS.DAL.Normal_UserDAL();
            JumboECMS.DAL.Normal_AdminlogsDAL _Adminlogs = new JumboECMS.DAL.Normal_AdminlogsDAL();
            _User.ChangePsd(id, JumboECMS.Utils.MD5.Lower32(this.txtUserPass.Text));
            _Adminlogs.SaveLog(AdminId, "修改了ID为" + id + "的用户的密码为:" + this.txtUserPass.Text);
            FinalMessage("成功保存", "close.htm", 0);
        }
Esempio n. 2
0
        private void GetLoginbar()
        {
            string tempBody   = string.Empty;
            string returninfo = string.Empty;

            if (f("state") == "1")
            {
                string uName = f("name");
                string uPass = f("pass");
                returninfo = new JumboECMS.DAL.Normal_UserDAL().ChkUserLogin(uName, uPass, 1);
            }
            if (Cookie.GetValue(site.CookiePrev + "user") != null)
            {
                string UserId        = Cookie.GetValue(site.CookiePrev + "user", "id");
                string UserName      = Cookie.GetValue(site.CookiePrev + "user", "name");
                string UserNickName  = Cookie.GetValue(site.CookiePrev + "user", "nickname");
                string UserPass      = Cookie.GetValue(site.CookiePrev + "user", "password");
                string UserGroupName = Cookie.GetValue(site.CookiePrev + "user", "groupname");
                int    _newcart      = new JumboECMS.DAL.Normal_UserCartDAL().GetNewGoods(UserId);
                JumboECMS.Entity.Normal_User _User = new JumboECMS.DAL.Normal_UserDAL().GetEntity(UserId);
                tempBody = "{\"result\" :\"1\"," +
                           "userid :\"" + UserId + "\"," +
                           "username :\"" + UserName + "\"," +
                           "nickname :\"" + UserNickName + "\"," +
                           "userpass :\"" + UserPass + "\"," +
                           "userkey :\"" + UserPass.Substring(4, 8) + "\"," +
                           "groupname :\"" + UserGroupName + "\"," +
                           "newcart :\"" + _newcart + "\"," +
                           "adminid :\"" + _User.AdminId + "\"" +
                           "}";
                this._response = tempBody;
            }
            else
            {
                this._response = "{\"result\" :\"0\"";
                if (f("state") == "1")
                {
                    this._response += ",\"returnval\" :\"" + returninfo + "\"";
                }
                this._response += "}";
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 验证登陆
 /// </summary>
 private void chkLogin()
 {
     if (Cookie.GetValue(site.CookiePrev + "user") != null)
     {
         UserId       = Cookie.GetValue(site.CookiePrev + "user", "id");
         UserGroupId  = Cookie.GetValue(site.CookiePrev + "user", "groupid");
         UserName     = Cookie.GetValue(site.CookiePrev + "user", "name");
         UserNickName = Cookie.GetValue(site.CookiePrev + "user", "nickname");
         UserPass     = Cookie.GetValue(site.CookiePrev + "user", "password");
         UserEmail    = Cookie.GetValue(site.CookiePrev + "user", "email");
         UserKey      = UserPass.Substring(4, 8);
         UserSetting  = Cookie.GetValue(site.CookiePrev + "user", "setting");
         UserCookies  = Cookie.GetValue(site.CookiePrev + "user", "cookies");
         if (UserId.Length != 0 && UserName.Length != 0)
         {
             JumboECMS.Entity.Normal_User _User = new JumboECMS.DAL.Normal_UserDAL().GetEntity(UserId);
             if (_User.UserName.Length > 0)
             {
                 this.UserIsLogin = true;
             }
         }
     }
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Admin_Load("master", "stop");
     id = Str2Str(q("id"));
     if (id == "0")
     {
         int _uID = new JumboECMS.DAL.Normal_UserDAL().Register("(admin)" + GetRandomNumberString(10), GetRandomNumberString(16), false, 0, GetRandomNumberString(12) + "@126.com", System.DateTime.Now.ToShortTimeString(), GetRandomNumberString(32), "", "");
         Response.Redirect("admin_add.aspx?id=" + _uID);
         Response.End();
     }
     else
     {
         JumboECMS.DBUtility.WebFormHandler wh = new JumboECMS.DBUtility.WebFormHandler(doh, "jcms_normal_user", btnSave);
         wh.AddBind(lblUserName, "UserName", true);
         wh.AddBind(txtAdminName, "AdminName", true);
         wh.AddBind(rbtnAdminState, "SelectedValue", "AdminState", false);
         this.txtAdminName.ReadOnly = false;
         wh.ConditionExpress        = "id=" + id;
         wh.Mode      = JumboECMS.DBUtility.OperationType.Modify;
         wh.validator = chkForm;
         wh.ModifyOk += new EventHandler(save_ok);
     }
 }
Esempio n. 5
0
        private void GetUserInfo()
        {
            string tempBody   = string.Empty;
            string _userid    = "0";
            string _groupname = string.Empty;

            if (Cookie.GetValue(site.CookiePrev + "user") != null)
            {
                _userid    = Cookie.GetValue(site.CookiePrev + "user", "id");
                _groupname = Cookie.GetValue(site.CookiePrev + "user", "groupname");
                tempBody   = "{\"result\" :\"1\",";
                JumboECMS.Entity.Normal_User _User = new JumboECMS.DAL.Normal_UserDAL().GetEntity(_userid);
                int _newcart = new JumboECMS.DAL.Normal_UserCartDAL().GetNewGoods(_userid);
                tempBody += "userid :\"" + _User.Id + "\"," +
                            "username :\"" + _User.UserName + "\"," +
                            "nickname :\"" + _User.NickName + "\"," +
                            "userpass :\"" + _User.UserPass + "\"," +
                            "userkey :\"" + _User.UserPass.Substring(4, 8) + "\"," +
                            "email :\"" + _User.Email + "\"," +
                            "sex :\"" + _User.Sex + "\"," +
                            "truename :\"" + _User.TrueName + "\"," +
                            "idcard :\"" + _User.IDCard + "\"," +
                            "groupname :\"" + _groupname + "\"," +
                            "newcart :\"" + _newcart + "\"," +
                            "birthday :\"" + _User.BirthDay + "\"," +
                            "provincecity :\"" + _User.ProvinceCity + "\"," +
                            "workunit :\"" + _User.WorkUnit + "\"," +
                            "address :\"" + _User.Address + "\"," +
                            "zipcode :\"" + _User.ZipCode + "\"," +
                            "qq :\"" + _User.QQ + "\"," +
                            "msn :\"" + _User.MSN + "\"," +
                            "mobiletel :\"" + _User.MobileTel + "\"," +
                            "telephone :\"" + _User.Telephone + "\"," +
                            "adminid :\"" + _User.AdminId + "\"," +
                            "adminname :\"" + _User.AdminName + "\"" +
                            "}";
            }
            else
            {
                tempBody  = "{\"result\" :\"0\",";
                tempBody += "userid :\"0\"," +
                            "username :\"\"," +
                            "nickname :\"\"," +
                            "userpass :\"\"," +
                            "userkey :\"\"," +
                            "email :\"\"," +
                            "sex :\"0\"," +
                            "truename :\"\"," +
                            "idcard :\"\"," +
                            "groupname :\"\"," +
                            "newcart :\"0\"," +
                            "birthday :\"\"," +
                            "provincecity :\"\"," +
                            "workunit :\"\"," +
                            "address :\"\"," +
                            "zipcode :\"\"," +
                            "qq :\"\"," +
                            "msn :\"\"," +
                            "mobiletel :\"\"," +
                            "telephone :\"\"," +
                            "adminid :\"0\"," +
                            "adminname :\"\"" +
                            "}";
            }
            this._response = tempBody;
        }
Esempio n. 6
0
        /// <summary>
        /// 会员登录
        /// </summary>
        /// <param name="_username">登录名</param>
        /// <param name="_userpass">密码</param>
        /// <param name="iExpires">保存信息的天数</param>
        /// <returns></returns>
        public string ChkUserLogin(string _username, string _userpass, int iExpires)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                _username = _username.Replace("\'", "");
                _doh.Reset();
                _doh.ConditionExpress = "username=@username";
                _doh.AddConditionParameter("@username", _username);
                string _userid = _doh.GetField("jcms_normal_user", "id").ToString();
                if (_userid != "")
                {
                    JumboECMS.Entity.Normal_User _User = new JumboECMS.DAL.Normal_UserDAL().GetEntity(_userid);
                    if (_User.UserPass.Length == 16)//老密码
                    {
                        if (_User.UserPass != JumboECMS.Utils.MD5.Lower16(_userpass))
                        {
                            return("密码错误");
                        }
                    }
                    else
                    {
                        if (_User.UserPass != JumboECMS.Utils.MD5.Lower32(_userpass))
                        {
                            return("密码错误");
                        }
                    }
                    if (_User.State != 1)
                    {
                        return("帐号被锁定");
                    }
                    _doh.Reset();
                    _doh.SqlCmd = "SELECT [id],[GroupName],[IsLogin],[Setting] FROM [jcms_normal_usergroup] WHERE [Id]=" + _User.Group;
                    DataTable dtUserGroup = _doh.GetDataTable();
                    if (dtUserGroup.Rows.Count == 0)
                    {
                        return("用户组有误");
                    }
                    if (dtUserGroup.Rows[0]["IsLogin"].ToString() != "1")
                    {
                        return("帐号禁止登录");
                    }
                    string _userGroupid   = dtUserGroup.Rows[0]["Id"].ToString();
                    string _userGroupname = dtUserGroup.Rows[0]["GroupName"].ToString();
                    string _userSetting   = dtUserGroup.Rows[0]["Setting"].ToString();
                    dtUserGroup.Clear();
                    dtUserGroup.Dispose();
                    string _userCookies = "c" + (new Random().Next(10000000, 99999999)).ToString();
                    //设置Cookies
                    System.Collections.Specialized.NameValueCollection myCol = new System.Collections.Specialized.NameValueCollection();
                    myCol.Add("id", _userid);
                    myCol.Add("name", _User.UserName);
                    myCol.Add("nickname", _User.NickName);
                    myCol.Add("password", _User.UserPass);
                    myCol.Add("email", _User.Email);
                    myCol.Add("groupid", _userGroupid);
                    myCol.Add("groupname", _userGroupname);
                    myCol.Add("setting", _userSetting);
                    myCol.Add("cookies", _userCookies);
                    JumboECMS.Utils.Cookie.SetObj(site.CookiePrev + "user", 60 * 60 * 24 * iExpires, myCol, site.CookieDomain, site.CookiePath);

                    //更新User登陆信息
                    _doh.Reset();
                    _doh.ConditionExpress = "id=@id and state=1";
                    _doh.AddConditionParameter("@id", _userid);
                    if (_User.UserPass.Length == 16)//老密码
                    {
                        _doh.AddFieldItem("UserPass", JumboECMS.Utils.MD5.Lower32(_userpass));
                    }
                    _doh.AddFieldItem("Cookies", _userCookies);
                    _doh.AddFieldItem("LastTime", DateTime.Now.ToString());
                    _doh.AddFieldItem("LastIP", IPHelp.ClientIP);
                    _doh.AddFieldItem("UserSign", "");
                    _doh.Update("jcms_normal_user");
                    return("ok");
                }
                else
                {
                    return("帐号不存在");
                }
            }
        }