Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ParamPlayerSelfRegAcc param = new ParamPlayerSelfRegAcc();

            param.m_strData = Request.QueryString["data"];
            param.m_sign    = Request.QueryString["sign"];
            param.m_ip      = Request.ServerVariables.Get("Remote_Addr").ToString();

            DyOpPlayerSelfRegAcc dy = new DyOpPlayerSelfRegAcc();
            string resStr           = dy.doDyop(param);

            Response.Write(resStr);
        }
Beispiel #2
0
    public override string doDyop(object param)
    {
        ParamPlayerSelfRegAcc p = (ParamPlayerSelfRegAcc)param;
        int code = p.isParamValid();

        if (code != 0)
        {
            return(returnMsg(code.ToString()));
        }

        Dictionary <string, object> data = p.getData();

        string acc = Convert.ToString(data["n1"]);

        if (!Regex.IsMatch(acc, Exp.ACCOUNT_PLAYER))
        {
            return(returnMsg(HttpRetCode.RET_ACC_ERROR.ToString()));
        }

        string pwd = AESHelper.AESDecrypt(data["n2"].ToString(), AES_KEY);

        if (pwd.Length != 32)
        {
            return(returnMsg(HttpRetCode.RET_PWD_ERROR.ToString()));
        }

        MySqlDbServer sqlDb = new MySqlDbServer(CC.MYSQL_IP);

        string cmd = string.Format(SQL_CMD, TableName.GM_ACCOUNT, p.m_gmId - ConstDef.GM_ID_OFFSET);
        Dictionary <string, object> agentData = sqlDb.queryOne(cmd, MySqlDbName.DB_XIANXIA);

        if (agentData == null)
        {
            return(returnMsg(HttpRetCode.RET_AGENT_ACC_ERROR.ToString()));
        }

        int accType = Convert.ToInt32(agentData["accType"]);

        if (accType != AccType.ACC_AGENCY) // Íæ¼ÒÕ˺ÅÖ»ÄÜÒÔ´úÀíºÅ×÷Ϊ´´½¨Õß
        {
            return(returnMsg(HttpRetCode.RET_AGENT_ACC_ERROR.ToString()));
        }

        string creator    = Convert.ToString(agentData["acc"]);
        string createCode = Convert.ToString(agentData["createCode"]);

        code = createAccToMySql(acc, creator, createCode, sqlDb);
        if (code == HttpRetCode.RET_ACC_EXISTS || code == 0)
        {
            RSAHelper rsa = new RSAHelper();
            rsa.setModulus(Convert.ToString(data["n3"]));
            string clientKey = "";
            code = createAccToMongo(acc, pwd, p.m_ip, sqlDb, ref clientKey);

            if (code == 0)
            {
                return(returnMsg(rsa.RSAEncryptStr(clientKey), true));
            }
        }

        return(returnMsg(code.ToString()));
    }