Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            if (IsPostBack)
            {
                // 手机
                var phone = Request.Form["tel"];
                // 短信验证码
                var code = Request.Form["code"];
                // 身份
                var iden = Int32.Parse(Request.Form["iden"]);

                // 格式检查
                if (!OSecurity.ValidPhone(phone) ||     // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") || // 验证码4位数字
                    iden < 1 || iden > 5                // 身份在[1,5]
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                // 普通会员-业务员-施工队-管理员
                if (iden == 1 || iden == 2 || iden == 4 || iden == 5)
                {
                    if (DataBase.User.Exits(new Objects.User()
                    {
                        phone = phone,
                        identity = iden.ToString()
                    }))
                    {
                        Session["phone"] = phone;
                        Session["iden"]  = iden;
                        Response.Redirect("/UserIndex.aspx");
                    }
                }
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }

            if (IsPostBack)
            {
                // 姓名
                var name = Request.Form["name"];
                // 手机
                var phone = Request.Form["tel"];
                // 短信验证码
                var code = Request.Form["code"];
                // 身份
                var iden = Request.Form["iden"];

                // 格式检查
                if (name == "" ||                                  // 姓名不空
                    !OSecurity.ValidPhone(phone) ||                // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") ||            // 验证码4位数字
                    Int32.Parse(iden) < 1 || Int32.Parse(iden) > 5 // 身份在[1,5]
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                // 身份证(业务员-施工队-管理员)
                String IDCardYWY = null;
                // 身份证(经销商)
                String IDCardJXS;
                // 区县(经销商)
                String location;
                // 详细地址
                String detailLocation;

                if (iden == "2" || iden == "4" || iden == "5")
                {
                    IDCardYWY = Request.Form["idcard_ywy"];
                    // 身份证检查
                    if (!OSecurity.ValidIDCard(IDCardYWY))
                    {
                        return;
                    }
                }

                if ((iden == "1" || iden == "2" || iden == "4" || iden == "5") &&
                    DataBase.User.Add(new Objects.User()
                {
                    phone = phone,
                    name = name,
                    identity = iden,
                    IDCard = IDCardYWY
                }))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "success", "success(" + iden + ", '注册成功', true);", true);
                }
                // 经销商
                else if (iden == "3")
                {
                    IDCardJXS      = Request.Form["idcard_jxs"];
                    location       = Request.Form["location"];
                    detailLocation = Request.Form["detailLocation"];

                    // 不实现
                }
                else
                {
                    return;
                }
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 不是微信内置浏览器
            if (!WXManage.IsWXBrowser(Request))
            {
                Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
                return;
            }
            if (Request.QueryString["aid"] == null)
            {
                Response.Redirect("/Activity.aspx");
                return;
            }

            if (IsPostBack)
            {
                string phone          = Request.Form["tel"];            // 手机
                string name           = Request.Form["name"];           // 姓名
                string code           = Request.Form["code"];           // 验证码
                string location       = Request.Form["location"];       // 地址
                string locationDetail = Request.Form["detailLocation"]; // 详细地址

                // 格式检查
                if (name == "" ||                       // 姓名不空
                    !OSecurity.ValidPhone(phone) ||     // 手机号
                    !Regex.IsMatch(code, "^\\d{4}$") || // 验证码4位数字
                    location == ""                      // 详细地址为空
                    )
                {
                    return;
                }
                // 验证码检查
                if (!AuthCode.CheckAuthCode(phone, code))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "codeError", "alterError($('input[name=code]')[0]);", true);
                    return;
                }

                string activityID = Request.QueryString["aid"];
                string userID     = Request.QueryString["uid"]; // 即手机号
                if (activityID == "" || userID == "")
                {
                    return;
                }
                var activity = DataBase.Activity.Get(new Objects.Activity()
                {
                    id = activityID
                });
                if (activity == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "noaid", "alert('不存在此活动!');", true);
                    return;
                }
                if (activity.timeEnd <= DateTime.Now)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "ended", "alert('活动已结束!');", true);
                    return;
                }

                var user = DataBase.User.Get(new Objects.User()
                {
                    phone = userID, identity = "1"
                });
                if (user == null)
                {
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "nouid", "alert('不存在该推荐人!');", true);
                    return;
                }

                if (DataBase.ActivitySign.Add(new Objects.ActivitySign()
                {
                    name = name,
                    phone = phone,
                    location = location,
                    locationDetail = locationDetail,
                    activityID = activityID,
                    shareSource = userID
                }))
                {
                    // 发送新报名提示
                    var admins = DataBase.User.Gets("5");
                    foreach (var admin in admins)
                    {
                        var openid = DataBase.User.GetOpenID(admin);
                        if (!string.IsNullOrEmpty(openid))
                        {
                            WXManage.SendMessage(openid, "有一条新报名信息!");
                        }
                    }
                    Response.Redirect("/ActivitySignSuccess.aspx");
                    return;
                }
            }
        }