Exemple #1
0
        private static string ParamSignif2016(string sceretKey, params object[] param)
        {
            Dictionary <string, string> nvs = new Dictionary <string, string>();

            if (param.Length % 2 != 0)
            {
                return("");
            }
            for (int i = 0; i < param.Length; i += 2)
            {
                string key   = param[i].ToString();
                string value = param[i + 1].ToString();
                nvs[key] = value;
            }
            string[] keys = new string[nvs.Keys.Count];

            nvs.Keys.CopyTo(keys, 0);
            Array.Sort(keys);
            StringBuilder sb = new StringBuilder();

            // sb.Append(sceretKey);
            foreach (string key in keys)
            {
                sb.Append(key).Append(nvs[key]);
            }
            sb.Append(sceretKey);

            string signature = UrsHelper.MD5(sb.ToString().ToLower());

            return(signature);
        }
Exemple #2
0
        public string MakeSign(Dictionary <string, Object> dicParams)
        {
            if (dicParams == null || dicParams.Count == 0)
            {
                throw new ArgumentNullException(nameof(dicParams));
            }
            string[] keys = dicParams.Keys.ToArray();
            Array.Sort(keys);
            StringBuilder sb = new StringBuilder();

            foreach (var key in keys)
            {
                sb.Append(key);
                sb.Append(dicParams[key]);
            }
            sb.Append(NegotiationValue);

            return(UrsHelper.MD5(sb.ToString()).ToLower());
        }
Exemple #3
0
        public IActionResult func_reg(RegModel regModel)
        {
            string acct          = regModel.email;
            string pass          = regModel.pass ?? string.Empty;
            string encrypt       = regModel.encrypt ?? string.Empty;
            bool   passisencrypt = regModel.encrypt == "True" || regModel.encrypt == "true";
            string tname         = regModel.tname ?? string.Empty;
            string mobile        = regModel.mobile ?? string.Empty;
            string idcard        = regModel.idcard ?? string.Empty;
            string gatesrc       = regModel.gatesrc ?? "urs";
            string pstype        = regModel.pstype ?? "game";
            int    qq            = regModel.qq;
            string ipstr         = regModel.ip ?? string.Empty;
            string regip         = ipstr;
            bool   hasip         = !string.IsNullOrWhiteSpace(ipstr) && ipstr.Length > 7;
            int    ip            = ip2long(ipstr);

            string          ipkey        = string.Format("check-reg-ip-{0}", ip);
            object          obj          = UrsHelper.Cache_GetObj(ipkey);
            List <DateTime> li_ipreglist = new List <DateTime>();

            if (obj != null && obj is List <DateTime> )
            {
                li_ipreglist = (List <DateTime>)obj;
                int regcount = 0;
                for (int i = li_ipreglist.Count - 1; i >= 0; i--)
                {
                    DateTime d = li_ipreglist[i];
                    if (Math.Abs((DateTime.Now - d).TotalSeconds) > 900)
                    {
                        li_ipreglist.RemoveAt(i);
                    }
                    else
                    {
                        regcount++;
                    }
                }
                if (regcount >= 101)//放得较宽,以防如3G网之类的可能有问题
                {
                    this.FuncResult(new APIReturn(10320, "注册频繁"));
                }
            }

            string vcode = regModel.vcode;

            if (regModel.ismodenopass)
            {
                pass          = "******";
                passisencrypt = true;
            }
            string passmd5 = passisencrypt ? pass : UrsHelper.MD5(pass);

            if (passmd5 == "0ab7dea79b1de3d0816f8b5cbbb36367")
            {
                //Operator.CHT_ExtData["ismodenopass"] = true;
                regModel.ismodenopass = true;
            }

            WebParams webParans = new WebParams(this.Request);
            var       dicValues = webParans.Where(e => e.Key.StartsWith("extarg_")).ToDictionary(e => e.Key, e => e.Value);
            Hashtable cht_args  = new Hashtable(dicValues);

            if (qq <= 0)
            {
                qq = 0;
            }
            string friendname = UrsHelper.Lib_Friend_GetName(acct);

            if (friendname.Length > 0)
            {
                this.FuncResult(new APIReturn(10350, string.Format("{0}帐号不能在这里进行注册操作", friendname)));
            }

            string[] acctspt = acct.Split('@');
            string   domain  = acctspt[1].ToLower();

            if (domain.EndsWith("2980.com") && domain != "2980.com" ||
                domain == "2925.com" ||
                acct.ToLower().IndexOf("@henhaoji.com") != -1 ||
                acct.ToLower().IndexOf("@duoyi.com") != -1)
            {
                this.FuncResult(new APIReturn(10355, "该类邮箱不支持注册,请选用其他邮箱"));
            }
            if (friendname != string.Empty)
            {
                this.FuncResult(new APIReturn(10326, string.Format("{0}帐号无需注册,可直接登录", friendname)));
            }
            if (!isemail(acct))
            {
                this.FuncResult(new APIReturn(10302, "帐号格式错误"));
            }
            if (!isvpass(pass, passisencrypt))
            {
                this.FuncResult(new APIReturn(10305, "密码格式错误"));
            }
            if (!string.IsNullOrWhiteSpace(idcard) && idcard.Length > 0 && !isidcard(idcard))
            {
                this.FuncResult(new APIReturn(10711, "身份证格式错误"));
            }
            if (!string.IsNullOrWhiteSpace(tname) && tname.Length > 0 && !isvname(tname))
            {
                this.FuncResult(new APIReturn(10720, "姓名格式错误"));
            }
            if (!string.IsNullOrWhiteSpace(mobile) && mobile.Length >= 1 && !IsMobile(mobile))
            {
                this.FuncResult(new APIReturn(10701, "手机号格式错误"));
            }
            if (regModel.qq.ToString().Length >= 5 && (qq <= 0))
            {
                this.FuncResult(new APIReturn(10730, "QQ号格式错误"));
            }
            if (passisencrypt)
            {
                if (pass.Length != 32)
                {
                    this.FuncResult(new APIReturn(10000, $"参数错误pass={pass}"));
                }
                pass = UrsHelper.MD5(pass.Substring(7, 16)).Substring(3, 16);
            }
            return(func_exec_reg(regModel, false, ip, acct, pass, passisencrypt, tname, idcard, mobile, qq, gatesrc, pstype, cht_args.ToJson(), regip));
        }
Exemple #4
0
 public string getGuid()
 {
     return(UrsHelper.MD5(deviceinfo));
 }