Beispiel #1
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        MojoCube.Web.Member.Online online = new MojoCube.Web.Member.Online();
        int index = 0;

        //删除
        if (e.CommandName == "_delete")
        {
            index = Convert.ToInt32(e.CommandArgument);
            online.DeleteData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text));
        }
        GridBind();
    }
Beispiel #2
0
    private void MemberLogin(string userName, string passWord)
    {
        if (txtPhone.Text == "" || txtPassword.Text.Trim() == "")
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "请填写手机号和密码");
            return;
        }

        //判断是否存在用户名及验证码是否正确
        if (Session["SiteCheckCode"] == null)
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "请填写验证码");
            return;
        }
        if (Session["SiteCheckCode"] != null && Session["SiteCheckCode"].ToString().ToLower() != txtCode.Text.Trim().ToLower())
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "验证码错误");
            return;
        }

        if (userName != "" && passWord != "")
        {
            MojoCube.Web.Member.List user = new MojoCube.Web.Member.List();

            passWord = FormsAuthentication.HashPasswordForStoringInConfigFile(passWord, "MD5").ToLower().Trim();
            if (user.IsUser(userName, passWord) && !user.IsLock)
            {
                //更新用户数据
                user.SetLoginSession();
                user.LastLoginIP = MojoCube.Web.IP.Get();
                user.UpdateLastLogin(user.pk_Member);

                //记住登录信息
                MojoCube.Web.Member.List.SetLogin();

                //加入在线用户
                MojoCube.Web.Member.Online online = new MojoCube.Web.Member.Online();
                online.fk_Member = user.pk_Member;
                online.SessionID = Session.SessionID;
                online.IPAddress = MojoCube.Web.IP.Get();
                online.Browser   = MojoCube.Web.String.GetBrowser();
                online.TypeID    = 0;
                online.LoginTime = DateTime.Now.ToString();
                online.InsertData();

                if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
                {
                    Response.Redirect(Request.QueryString["url"]);
                }
                else
                {
                    Response.Redirect(MojoCube.Api.File.Function.GetRelativePath(MojoCube.Web.Site.Cache.GetUrlExtension("Member", MojoCube.Api.UI.Language.GetLanguage())));
                }
                Response.End();
            }
            else
            {
                MojoCube.Api.UI.Script.ScriptMessage(this, "错误的手机号或密码");
            }
        }
        else
        {
            MojoCube.Api.UI.Script.ScriptMessage(this, "错误的手机号或密码");
        }
    }