Esempio n. 1
0
 public ContentResult CheckUserName(string UserName)
 {
     bizUsers provider = new bizUsers();
     if (MyText.CheckHaveSymbol(UserName))
         return Content("1");
     if (provider.CheckUserName(UserName.Replace(" ", "").Trim()) == false)
         return Content("0");
     else
         return Content("1");
 }
Esempio n. 2
0
        public ActionResult Index(Users model)
        {
            string PrevTime =  Public.CommonHelper.GetCookie("MyReg", "Time");
            if (PrevTime != "")
            {
                TempData["Msg"] = "30���Ӻ����ٹ���ע��";
                return View();
            }

            model.UserName = GetNoSpaceStr(model.UserName);
            if (model.UserName.Length < 2)
            {
                TempData["Msg"] = "�û�������Ҫ�������ַ�";
                return View();
            }
            if (model.UserName.Length > 15)
            {
                TempData["Msg"] = "�û������ܳ���15���ַ�";
                return View();
            }
            if (MyText.CheckHaveSymbol(model.UserName))
            {
                TempData["Msg"] = "�û����в��ܺ��������ַ�";
                return View();
            }
            if (CommonCache.FilterTexthHave(model.UserName))
            {
                TempData["Msg"] = "�û����а�����дʣ�����ע��";
                return View();
            }
            bizUsers provider = new bizUsers();
            if (provider.CheckUserName(model.UserName) == true)
            {
                TempData["Msg"] = "���û����Ѿ���ע��";
                return View();
            }

            model.UserColor = model.Sex == 0 ? "red" : "blue";
            int userID = provider.Add(model);

            Public.CommonHelper.LoginDeal(HttpContext, model.UserName, MyText.GetEncrypt(model.Password));

            //����Cookie
            HttpCookie myc = new HttpCookie("MyReg");
            myc["Time"] = DateTime.Now.ToString();
            myc.Expires = DateTime.Now.AddMinutes(30);
            Response.AppendCookie(myc);

            return RedirectToAction("RegisterOK");
        }