Exemplo n.º 1
0
        public void UpdateFavor()
        {
            using (DBClient client = new DBClient())
            {
                string myStringIsBigIsVeryVeryBig = "";
                for (int i = 0; i < favoritSources.Count; ++i)
                {
                    myStringIsBigIsVeryVeryBig += favoritSources[i] + ";";
                }
                MySqlParameters mysql_params = new MySqlParameters();
                mysql_params.AddParameter("favor", myStringIsBigIsVeryVeryBig);
                mysql_params.AddParameter("login", User.Name);

                client.Query("UPDATE users SET favorites_source = @favor WHERE login=@login", mysql_params);
            }
        }
Exemplo n.º 2
0
        public static bool Registration(string login, string password, string email)
        {
            using (DBClient mysql_client = new DBClient())
            {
                string query = @"SELECT login FROM users WHERE login = @login;";

                if (mysql_client.SelectQuery(query, new MySqlParameter("login", login.ToLower())).Count > 0)
                {
                    return(false);
                }
                else
                {
                    MySqlParameters mysql_params = new MySqlParameters();

                    mysql_params.AddParameter(new MySqlParameter("login", login.ToLower()));
                    mysql_params.AddParameter(new MySqlParameter("password", MD5Hashing.GetMd5Hash(password)));
                    mysql_params.AddParameter(new MySqlParameter("email", email));
                    mysql_client.Query("INSERT INTO users (login, password, email) VALUES (@login, @password, @email)", mysql_params);
                    return(true);
                }
            }
        }