[release]troubleshoot login freezing in loft [do not know if it works well]

10/14/2008 05:05 konkizta#1
go to Database.cs , Search public static byte Authenticate

and replace it with:

Code:
 public static byte Authenticate(string UserName, string Password)
        {
            try
            {
                MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection);
                DataSet DSet = new DataSet();

                DataAdapter.Fill(DSet, "Account");

                if (DSet == null)
                    return 0;
                if (DSet.Tables.Count == 0)
                    return 0;
                if (DSet.Tables["Account"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Account"].Rows[0];

                    string Pass = (string)DR["Password"];
                    if (Pass == Password || Pass == "")
                    {
                        if (Pass == "")
                        {
                            MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection);
                            Command.ExecuteNonQuery();
                        }

                        uint LogonCount = (uint)DR["LogonCount"];
                        LogonCount++;
                        MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection);
                        Comm.ExecuteNonQuery();

                        return Convert.ToByte((uint)DR["LogonType"]);
                    }
                    else
                        return 0;
                }
                else
                    return 0;
            }
            catch (Exception Exc) { Console.WriteLine(Exc.ToString()); return 0; }
        }
I'm not sure that it works very well leave your comments please ...
10/14/2008 12:23 pauldexter#2
nice work dude!
but how try it if it works and how to create/make a login freeze bug?