Exemple #1
0
 public void WriteUser(Account user)
 {
     string sqlstr;
     if (user != null && this.isConnected() == true)
     {
         sqlstr = string.Format("UPDATE `login` SET `username`='{0}',`password`='{1}',`deletepass`='{2}'" +
              " WHERE account_id='{3}' LIMIT 1",
              user.Name, user.Password, user.DeletePassword, user.AccountID);
         try
         {
             SQLExecuteNonQuery(sqlstr);
         }
         catch (Exception ex)
         {
             Logger.ShowError(ex);
         }
     }
 }
Exemple #2
0
        public void OnLogin(Packets.Client.CSMG_LOGIN p)
        {
            p.GetContent();
            if (LoginServer.accountDB.CheckPassword(p.UserName, p.Password, this.frontWord, this.backWord))
            {
                Packets.Server.SSMG_LOGIN_ACK p1 = new SagaLogin.Packets.Server.SSMG_LOGIN_ACK();
                p1.LoginResult = SagaLogin.Packets.Server.SSMG_LOGIN_ACK.Result.OK;
                this.netIO.SendPacket(p1);

                account = LoginServer.accountDB.GetUser(p.UserName);

                uint[] charIDs = LoginServer.charDB.GetCharIDs(account.AccountID);

                account.Characters = new List<ActorPC>();
                for (int i = 0; i < charIDs.Length; i++)
                {
                    account.Characters.Add(LoginServer.charDB.GetChar(charIDs[i]));
                }

                this.SendCharData();
            }
            else
            {
                Packets.Server.SSMG_LOGIN_ACK p1 = new SagaLogin.Packets.Server.SSMG_LOGIN_ACK();
                p1.LoginResult = SagaLogin.Packets.Server.SSMG_LOGIN_ACK.Result.GAME_SMSG_LOGIN_ERR_BADPASS;
                this.netIO.SendPacket(p1);
            }
        }
Exemple #3
0
 public Account GetUser(string name)
 {
     string sqlstr;
     DataRowCollection result = null;
     Account account;
     sqlstr = "SELECT * FROM `login` WHERE username='******' LIMIT 1";
     try
     {
         result = SQLExecuteQuery(sqlstr);
     }
     catch (Exception ex)
     {
         Logger.ShowError(ex);
         return null;
     }
     if (result.Count == 0) return null;
     account = new Account();
     account.AccountID = (int)(uint)result[0]["account_id"];
     account.Name = name;
     account.Password = (string)result[0]["password"];
     account.DeletePassword = (string)result[0]["deletepass"];
     account.GMLevel = (byte)result[0]["gmlevel"];
     return account;
 }