Esempio n. 1
0
    protected void btnReg_Click(object sender, EventArgs e)
    {
        //检查输入
        string inputErrorInfo = "";

        if (!PF.CheckUserName(tbUserName.Text))
        {
            inputErrorInfo += "对不起用户名中含有禁止使用的字符.\r\n";
        }

        if (Shove._String.GetLength(tbUserName.Text) < 5 || Shove._String.GetLength(tbUserName.Text) > 16)
        {
            inputErrorInfo += "用户名长度在 5-16 个英文字符或数字、中文 3-8 之间.\r\n";
        }

        if (tbPassword.Text.Length < 6 || tbPassword.Text.Length > 16)
        {
            inputErrorInfo += "密码长度必须在 6-16 位之间.\r\n";
        }

        if (tbSiteName.Text.Trim().Length == 0)
        {
            inputErrorInfo += "网站名称不能为空.\r\n";
        }
        if (tbSiteURL.Text.Trim().Length == 0)
        {
            inputErrorInfo += "网站地址不能为空.\r\n";
        }

        if (!Shove._String.Valid.isEmail(tbEmail.Text))
        {
            inputErrorInfo += "电子邮件地址格式不正确.\r\n";
        }
        if (!ckbAgree.Checked)
        {
            inputErrorInfo += "必须同意本站会员注册协议才能注册会员。\r\n";
        }

        if (CheckCode2.Visible)
        {
            if (tbCheckCode.Text.Trim() == "")
            {
                inputErrorInfo += "请输入验证码!\n";
            }
            else
            {
                if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
                {
                    inputErrorInfo += "验证码输入有误!\n";
                }
            }
        }

        if (inputErrorInfo != "")
        {
            lblInputError.Visible = true;
            lblInputError.Text    = "输入资料错误:\r\n" + inputErrorInfo;
            return;
        }

        long CpsID       = -1;
        long CommenderID = -1;

        if (Session[KeyPromotionUserID] != null)
        {
            CommenderID = Shove._Convert.StrToLong(Session[KeyPromotionUserID].ToString(), -1);
        }


        //检查推荐人是否为CPS商家,是就把此会员标记CSPID
        object tempOjb = Shove.Database.MSSQL.ExecuteScalar("select ID from T_Cps where OwnerUserID=" + CommenderID, new Shove.Database.MSSQL.Parameter[0]);

        if (tempOjb != null)
        {
            CpsID = Shove._Convert.StrToLong(tempOjb.ToString(), -1);
        }

        System.Threading.Thread.Sleep(500);

        string Name     = tbUserName.Text.Trim();
        string Password = tbPassword.Text.Trim();
        string Email    = tbEmail.Text.Trim();
        string Mobile   = tbTel.Text.Trim();
        string QQ       = tbQQ.Text.Trim();


        Users user = new Users(_Site.ID);

        user.Name     = Name;
        user.Password = Password;
        user.Email    = Email;
        user.Mobile   = Mobile;
        user.QQ       = QQ;
        user.UserType = 2;


        if (CpsID > 0)//推荐人为cps商家就填CpsID字段
        {
            user.CommenderID = -1;
            user.CpsID       = CpsID;
        }
        else
        {
            user.CommenderID = CommenderID;
            user.CpsID       = -1;
        }

        string ReturnDescription = "";
        int    Result            = user.Add(ref ReturnDescription);

        if (Result < 0)
        {
            Shove._Web.JavaScript.Alert(this, ReturnDescription);

            return;
        }
        else //注册成功,加入CPS站长商家
        {
            double    cpsBonusScale = 0.00;
            DataTable dtTemp        = new DAL.Tables.T_Sites().Open("Opt_CpsBonusScale", "", "");
            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                cpsBonusScale = double.Parse(dtTemp.Rows[0]["Opt_CpsBonusScale"].ToString());
            }
            user.cps.SiteID    = 1;
            user.cps.CommendID = CommenderID;

            user.cps.Name       = tbSiteName.Text;
            user.cps.Url        = tbSiteURL.Text;
            user.cps.BonusScale = cpsBonusScale;
            user.cps.ON         = true;

            user.cps.Telephone  = tbTel.Text.Trim();
            user.cps.Email      = Email;
            user.cps.QQ         = QQ;
            user.cps.Type       = 2;
            user.cps.DomainName = user.GetPromotionURL(0);

            if (user.cps.Add(ref ReturnDescription) < 0)
            {
                Shove._Web.JavaScript.Alert(this, ReturnDescription);

                return;
            }
        }

        Result = user.Login(ref ReturnDescription);

        if (Result < 0)
        {
            Shove._Web.JavaScript.Alert(this, ReturnDescription);

            return;
        }

        Response.Redirect("../../Default.aspx");
    }
Esempio n. 2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (tbName.Text.Trim() == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入用户名。");

            return;
        }

        if (string.IsNullOrEmpty(tbRealityName.Text.Trim()))
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入真实姓名。");

            return;
        }

        if (CheckCode.Visible)
        {
            if (tbCheckCode.Text.Trim() == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");

                return;
            }
            else
            {
                if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");

                    return;
                }
            }
        }

        System.Threading.Thread.Sleep(500);

        Sites site = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];

        if (site == null)
        {
            return;
        }

        long   CpsID = -1;
        string URL   = new FirstUrl().Get();

        if (!URL.StartsWith("http://"))
        {
            URL = "http://" + URL;
            URL = URL.Split('?'.ToString().ToCharArray())[0];
        }
        DataTable dt = new DAL.Tables.T_Cps().Open("id, [ON], [Name]", "SiteID = " + _Site.ID.ToString() + " and DomainName = '" + URL + "' or DomainName='" + Shove._Web.Utility.GetUrl() + "'", "");

        if ((dt != null) && (dt.Rows.Count > 0))
        {
            if (Shove._Convert.StrToBool(dt.Rows[0]["ON"].ToString(), false))
            {
                CpsID = Shove._Convert.StrToLong(dt.Rows[0]["ID"].ToString(), -1);
            }
        }

        string Password = GetRandPassword();

        Users user = new Users(site.ID);

        user.Name        = tbName.Text.Trim();
        user.RealityName = tbRealityName.Text.Trim();
        user.Password    = Password;
        user.PasswordAdv = Password;
        user.CityID      = 1;
        user.Email       = labAccount.Text.Trim();
        user.ComeFrom    = 4;
        user.UserType    = 2;
        user.CpsID       = CpsID;
        user.CommenderID = -1;

        string ReturnDescription = "";

        if (user.Add(ref ReturnDescription) < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, ReturnDescription + "用户添加失败");

            return;
        }

        DAL.Tables.T_Users T_Users = new DAL.Tables.T_Users();
        T_Users.AlipayName.Value          = labAccount.Text;
        T_Users.AlipayID.Value            = hidUserID.Value;
        T_Users.isAlipayNameValided.Value = true;
        T_Users.Update("[ID] = " + user.ID.ToString());

        user.LoginDirect(ref ReturnDescription);

        this.Response.Redirect("UserRegSuccess.aspx", true);
    }
Esempio n. 3
0
    protected void btnOK_Click(object sender, EventArgs e)
    {

        #region 验证
        if (tbName.Text.Trim() == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入用户名。");

            return;
        }

        if (tbTrueName.Text.Trim() == "")
        {
            Shove._Web.JavaScript.Alert(this.Page,"请输入真实姓名。");

            return;
        }

        if (tbPassword.Text == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入用户密码。");

            return;
        }

        if (tbPassword.Text.Length < 6)
        {
            Shove._Web.JavaScript.Alert(this.Page, "用户密码长度不足 6 位。");

            return;
        }

        if (tbPassword.Text != tbPassword2.Text)
        {
            Shove._Web.JavaScript.Alert(this.Page, "输入的两次密码不一致。");

            return;
        }

        if (tbEmail.Text.Trim() == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入您的邮箱。");

            return;
        }

        if (!Shove._String.Valid.isEmail(tbEmail.Text.Trim()))
        {
            Shove._Web.JavaScript.Alert(this.Page,"请正确输入您的邮箱。");

            return;
        }

        if (CheckCode.Visible)
        {
            if (tbCheckCode.Text.Trim() == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");

                return;
            }
            else
            {
                if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");

                    return;
                }
            }

        }
        #endregion

        System.Threading.Thread.Sleep(500);

        Sites site = new Sites()[Shove._Web.Utility.GetUrlWithoutHttp()];

        if (site == null)
        {
            return;
        }

        Users user = new Users(site.ID);

        user.Name =Shove._Web.Utility.FilteSqlInfusion(tbName.Text.Trim());
        user.RealityName = Shove._Web.Utility.FilteSqlInfusion(tbTrueName.Text.Trim());
        user.Password = Shove._Web.Utility.FilteSqlInfusion(tbPassword.Text.Trim());
        user.PasswordAdv = Shove._Web.Utility.FilteSqlInfusion(tbPassword.Text.Trim());
        user.CityID = 1;
        user.ComeFrom = 4;
        user.Email = Shove._Web.Utility.FilteSqlInfusion(tbEmail.Text.Trim());
        user.isEmailValided = true;
        user.QQ = tbQQID.Text.Trim();
        user.UserType = 2;
        user.CommenderID = -1;
        user.isQQValided = true;

        string ReturnDescription = "";

        int UserID = user.Add(ref ReturnDescription);

        if (UserID < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, ReturnDescription + "用户添加失败");

            return;
        }

        int Result = user.Login(ref ReturnDescription);

        if (Result < 0)
        {
            new Log("Users").Write("注册成功后登录失败:" + ReturnDescription);
            Shove._Web.JavaScript.Alert(this, ReturnDescription);

            return;
        }
        Response.Redirect("UserRegSuccess.aspx",true);
    }
Esempio n. 4
0
    protected void btnResetPassword_Click(object sender, System.EventArgs e)
    {
        System.Threading.Thread.Sleep(500);

        string key = Shove._Web.Utility.GetRequest("key").Trim();

        if (key == "" || key.Length <= 32)
        {
            pSetp1.Visible = false;
            pStep2.Visible = true;

            lbError.Text = "非法访问。";

            return;
        }

        string sign = key.Substring(0, 16) + key.Substring(key.Length - 16, 16);

        key = key.Substring(16, key.Length - 32);

        try
        {
            if (sign != BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(key))).Replace("-", ""))
            {
                pSetp1.Visible = false;
                pStep2.Visible = true;

                lbError.Text = "非法访问。";

                return;
            }

            key = Shove._Security.Encrypt.UnEncryptString(PF.GetCallCert(), key);

            long     userID = Shove._Convert.StrToLong(key.Split(',')[0], 0);
            DateTime time   = Convert.ToDateTime(key.Split(',')[1]);

            if (time.AddDays(1).CompareTo(DateTime.Now) < 0)
            {
                pSetp1.Visible = false;
                pStep2.Visible = true;

                lbError.Text = "该地址已过期。";

                return;
            }

            if (userID <= 0)
            {
                pSetp1.Visible = false;
                pStep2.Visible = true;

                lbError.Text = "非法访问。";

                return;
            }

            string password  = tbUserPassword.Text.Trim();
            string password2 = tbUserPassword2.Text.Trim();

            if (password == "")
            {
                Shove._Web.JavaScript.Alert(this, "新密码不能为空。");

                return;
            }

            if (password != password2)
            {
                Shove._Web.JavaScript.Alert(this, "两次密码输入不一致,请重新输入。");

                return;
            }

            if (password.Length < 6 || password.Length > 16)
            {
                Shove._Web.JavaScript.Alert(this, "密码长度必须为 6-16 位,请重新输入。");

                return;
            }

            bool isUseCheckCode = _Site.SiteOptions["Opt_isUseCheckCode"].ToBoolean(true);

            if ((isUseCheckCode) && !ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
            {
                Shove._Web.JavaScript.Alert(this, "验证码输入错误。");

                return;
            }

            Users user = new Users(_Site.ID);

            user.ID       = userID;
            user.Password = password;

            string ReturnDescription = "";

            int Result = user.EditByID(ref ReturnDescription);

            if (Result < 0)
            {
                PF.GoError(-1, ReturnDescription, this.GetType().FullName);

                return;
            }

            user.Login(ref ReturnDescription);

            pSetp1.Visible = false;
            pStep2.Visible = true;

            lbError.Text = "密码修改成功。<div class='blue' style='margin-top:10px;'>您现在可以前往 <a href='/Home/Room/ViewAccount.aspx'>【用户中心】</a> <a href='/Default.aspx'>【官网首页】</a></div>";
        }
        catch
        {
            pSetp1.Visible = false;
            pStep2.Visible = true;

            lbError.Text = "非法访问。";

            return;
        }
    }
Esempio n. 5
0
    protected void btnReg_Click(object sender, EventArgs e)
    {
        if (!cbAgree.Checked)
        {
            Shove._Web.JavaScript.Alert(this.Page, "必须同意注册协议!");

            return;
        }

        if (CheckCode.Visible)
        {
            if (tbCheckCode.Text.Trim() == "")
            {
                Shove._Web.JavaScript.Alert(this.Page, "请输入验证码!");

                return;
            }
            else
            {
                if (!ShoveCheckCode1.Valid(tbCheckCode.Text.Trim()))
                {
                    Shove._Web.JavaScript.Alert(this.Page, "验证码输入有误!");

                    return;
                }
            }
        }

        string url = tbWebUrl.Text;

        if (!url.StartsWith("http://"))
        {
            url = "http://" + url;
        }

        Regex regex = new Regex(@"([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        Match m     = regex.Match(url);

        if (!m.Success && url.IndexOf("http") == 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "网址填写错误");

            return;
        }

        double scale = scale = _Site.SiteOptions["Opt_CpsBonusScale"].ToDouble(0);

        if (_User == null)  //没有登录注册
        {
            Users user = new Users(_Site.ID);

            user.Name        = tbUserName.Text.Trim();
            user.Password    = tbPassword.Text.Trim();
            user.Email       = tbEmail.Text.Trim();
            user.RealityName = tbRealyName.Text.Trim();
            user.Mobile      = tbPhone.Text.Trim();
            user.QQ          = tbQQ.Text.Trim();
            user.UserType    = 2;

            string ReturnDescription = "";
            long   Result            = user.Add(ref ReturnDescription);

            if (Result < 0)
            {
                Shove._Web.JavaScript.Alert(this, ReturnDescription);

                return;
            }

            //登录
            Result = user.Login(ref ReturnDescription);

            if (Result < 0)
            {
                Shove._Web.JavaScript.Alert(this, ReturnDescription);

                return;
            }

            user.cps.BonusScale        = scale;
            user.cps.ON                = true;
            user.cps.ResponsiblePerson = tbRealyName.Text.Trim();
            user.cps.ContactPerson     = tbRealyName.Text.Trim();
            user.cps.Mobile            = tbPhone.Text.Trim();
            user.cps.Email             = tbEmail.Text.Trim();
            user.cps.QQ                = tbQQ.Text.Trim();
            user.cps.Type              = Shove._Convert.StrToShort(ddlCpsType.SelectedValue, 1);
            user.cps.OwnerUserID       = user.ID;
            user.cps.Url               = tbWebUrl.Text.Trim();
            user.cps.Name              = tbSiteName.Text.Trim();
            user.cps.MD5Key            = tbMD5.Text.Trim();
            user.cps.Content           = "";

            ReturnDescription = "";
            Result            = user.cps.Try(ref ReturnDescription);

            if (Result < 0)
            {
                Shove._Web.JavaScript.Alert(this, ReturnDescription);

                return;
            }

            Shove._Web.Cache.ClearCache("Cps_Administrator_CpsTry");
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (_User.cps.ID != -1)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您已注册成商家!");

                return;
            }

            if (new DAL.Tables.T_CpsTrys().GetCount("HandleResult = 0 and UserID=" + _User.ID.ToString()) > 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "您已申请过CPS,正在审核中。");

                return;
            }

            _User.cps.BonusScale        = scale;
            _User.cps.ON                = true;
            _User.cps.ResponsiblePerson = _User.RealityName;
            _User.cps.ContactPerson     = _User.RealityName;
            _User.cps.Mobile            = tbPhone.Text.Trim();
            _User.cps.Email             = tbEmail.Text.Trim();
            _User.cps.QQ                = tbQQ.Text.Trim();
            _User.cps.Type              = Shove._Convert.StrToShort(ddlCpsType.SelectedValue, 1);
            _User.cps.OwnerUserID       = _User.ID;
            _User.cps.Url               = tbWebUrl.Text.Trim();
            _User.cps.Name              = tbSiteName.Text.Trim();
            _User.cps.MD5Key            = tbMD5.Text.Trim();
            _User.cps.Content           = "";

            string ReturnDescription = "";
            int    Result            = _User.cps.Try(ref ReturnDescription);

            if (Result < 0)
            {
                Shove._Web.JavaScript.Alert(this, ReturnDescription);

                return;
            }

            Shove._Web.Cache.ClearCache("Cps_Administrator_CpsTry");

            Shove._Web.JavaScript.Alert(this.Page, "已经提交申请成功,工作人员会尽快处理!", "Default.aspx");
        }
    }