Exemplo n.º 1
0
    protected override void Execute()
    {
        string username = web.Param("username");
        string password = web.Param("password");

        string countryIP = "";
        if (!String.IsNullOrEmpty(Request["HTTP_CF_IPCOUNTRY"]))
            countryIP = Request["HTTP_CF_IPCOUNTRY"];            

        SqlCommand sqcmd = new SqlCommand();
        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WZ_ACCOUNT_LOGIN";
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
        sqcmd.Parameters.AddWithValue("@in_EMail", username);
        sqcmd.Parameters.AddWithValue("@in_Password", password);
        sqcmd.Parameters.AddWithValue("@in_Country", countryIP);

        if (!CallWOApi(sqcmd))
            return;

        reader.Read();
        int CustomerID = getInt("CustomerID");
        int AccountStatus = getInt("AccountStatus");
        int SessionID = 0;
        int IsDeveloper = 0;

        if (CustomerID > 0)
        {
            SessionID = getInt("SessionID");
            IsDeveloper = getInt("IsDeveloper");

            // if this is a steam user, check if he own game
            string SteamUserID = getString("SteamUserID");
            if (SteamUserID != "0")
            {
                SteamApi api = new SteamApi();
                bool Have_Game = api.CheckAppOwnership(SteamUserID, "226700"); // base game
                if (!Have_Game)
                {
                    // special 1001 code for running under steam but without game.
                    Response.Write("WO_0");
                    Response.Write(string.Format("{0} {1} {2}",
                        0, 0, 1001));
                    return;
                }
            }

            if (AccountStatus == 103)
            {
                // first time account lock, send email and override status to normal lock
                AccountStatus = 102;
                string LockToken = getString("LockToken");
                SendLockEmail(username, countryIP, LockToken);
            }

            if (IsDeveloper > 0)
            {
                RegisterLoginIP(CustomerID);
            }
        }

        GResponse.Write("WO_0");
        GResponse.Write(string.Format("{0} {1} {2}",
            CustomerID, SessionID, AccountStatus));
    }
Exemplo n.º 2
0
    protected override void Execute()
    {
        string SerialKey  = web.Param("serial");
        int    ReferralID = 0;

        // if we got steam ticket, auth it and link it to account
        string SteamID = "";

        try
        {
            string ticket = web.Param("ticket");

            // get steam user id from auth ticket
            SteamApi api = new SteamApi();
            SteamID = api.GetSteamId(ticket);
            if (SteamID.Length == 0)
            {
                Response.Write("WO_5");
                Response.Write("steam: can't auth");
                return;
            }

            bool Have_Game = api.CheckAppOwnership(SteamID, "226700"); // base game
            if (!Have_Game)
            {
                Response.Write("WO_5");
                Response.Write("steam: does not own game");
                return;
            }

            // check if we already have linked account (to prevent multiple accounts registering)
            if (CheckIfHaveSteamAccount(SteamID))
            {
                Response.Write("WO_7");
                Response.Write("steam: already have account");
                return;
            }

            // 227662 DLC is a special DLC that says that user bought game from Steam and not converted user
            bool Have_SteamKey = api.CheckAppOwnership(SteamID, "227662");
            if (!Have_SteamKey)
            {
                Response.Write("WO_B");
                Response.Write("steam: does not own 227662");
                return;
            }

            // overwrite serial key with special key for steam
            SerialKey  = "STEAM-226700-FGHYT-AWRTS-HZRTA";
            ReferralID = 10;
        }
        catch { }


        SqlCommand sqcmd = new SqlCommand();

        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WZ_ACCOUNT_CREATE";
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
        sqcmd.Parameters.AddWithValue("@in_EMail", web.Param("username")); // login name from updater
        sqcmd.Parameters.AddWithValue("@in_Password", web.Param("password"));
        sqcmd.Parameters.AddWithValue("@in_ReferralID", ReferralID);
        sqcmd.Parameters.AddWithValue("@in_SerialKey", SerialKey);
        sqcmd.Parameters.AddWithValue("@in_SerialEmail", web.Param("email"));   // email used in serial key purchase

        if (!CallWOApi(sqcmd))
        {
            return;
        }

        reader.Read();
        int CustomerID = getInt("CustomerID");

        Response.Write("WO_0");
        Response.Write(string.Format("{0}", CustomerID));

        // if we got steam id - link it to customer id
        if (SteamID.Length > 0)
        {
            sqcmd             = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WZ_SteamLinkAccount";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_SteamID", SteamID);

            CallWOApi(sqcmd);
        }
    }