Пример #1
0
        /// <summary>
        /// Login del jugador en la aplicación.
        /// </summary>
        /// <param name="n">Nombre.</param>
        /// <param name="ps">Contraseña.</param>
        /// <returns>Verdadero o falso.</returns>
        public bool loginPlayer(String n, String ps)
        {
            bool   val      = false;
            string sentence = "SELECT * FROM Players WHERE name = '" + n + "'";

            db.connection();
            MySqlDataReader read = db.select(sentence);

            if (read.Read())
            {
                pl.Name   = read.GetString("name");
                pl.Pwd    = read.GetString("pwd");
                pl.Avatar = read.GetString("avatar");
                pl.Wins   = read.GetInt32("wins");
                pl.Draws  = read.GetInt32("draws");
                pl.Loses  = read.GetInt32("loses");
            }
            db.disconnection();
            if (pl.Pwd.Equals(ps))
            {
                val = true;
            }
            return(val);
        }