Auxilium_Server.Program.HandleEditProfilePacket C# (CSharp) Method

HandleEditProfilePacket() static private method

static private HandleEditProfilePacket ( Client c, string avatar, string bio, string profile ) : void
c Auxilium_Server.Classes.Client
avatar string
bio string
profile string
return void
        static void HandleEditProfilePacket(Client c, string avatar, string bio, string profile)
        {
            if (!(avatar.Contains("http://") || avatar.Contains("https://")))
                avatar = avatar.Insert(0, "http://");
            if (!(profile.Contains("http://") || profile.Contains("https://")))
                profile = profile.Insert(0, "http://");

            bool validProfile = Regex.IsMatch(profile, @"^(http:\/\/|https:\/\/)*(www\.)*hackforums\.net\/member\.php\?action=profile&uid=\d{1,7}$");

            MySqlCommand q = new MySqlCommand("UPDATE users SET Avatar=@Avatar, Bio=@Bio, ProfileLink=@ProfileLink WHERE Username=@Username;", SQL);
            q.Parameters.AddWithValue("@Username", c.Value.Username);
            q.Parameters.AddWithValue("@Bio", bio);
            q.Parameters.AddWithValue("@Avatar", avatar);
            q.Parameters.AddWithValue("@ProfileLink", validProfile ? profile : "");

            bool success = q.ExecuteNonQuery() == 0;

            byte[] data = Packer.Serialize((byte)ServerPacket.EditProfile, success);
            c.Send(data);
        }