The thick blood that is accompanied by pains for four days is undoubtedly menstruation. The brown and red spots that come before the period are subject to further discussion:
If it is followed directly by the bleeding, then it is part of your period, so it is not permissible to pray and fast at that time.
If it is separate from the bleeding, then it is not part of your period.
The same applies to the stringy red discharge that you see for two days. If that happens before the tuhr [end of the period], then it is part of the period; if that happens after the tuhr, then it does not matter and it comes under the same ruling as the blood of istihaadah [non-menstrual bleeding] and does not mean that you cannot fast or pray, but you should do wudoo’ at the time of each prayer.
The tuhr or end of the period is indicated by one of two signs: either a clear discharge is emitted, or the place becomes dry, so that if it is wiped with a piece of cotton or something similar, it comes away clean with no trace of blood or yellowish or brownish discharge.
Shaykh Ibn Baaz (may Allaah have mercy on him) was asked: Before my period comes I have a brown discharge that lasts for five days, after which comes the menstrual blood. The menstrual blood lasts for eight days after the first five days. I pray on the five days but I wonder whether I should fast and pray on these days or not? Please advise me, may Allaah reward you.
If the five days on which you have the brown discharge are separate from the days when you bleed, then this is not menstruation, and you have to pray on these days and can fast, but you should do wudoo’ for each prayer, because this comes under the same ruling as urine, not the rulings on menstruation. So it does not mean that you cannot pray and fast, but it does mean that you have to do wudoo’ every time, until that discharge stops, as in the case of istihaadah (non-menstrual bleeding).
But if these five days are followed immediately by your period, then they are part of your period, so you should not fast or pray on these days.
Similarly, if this brownish or yellowish discharge comes after your period ends, it is not be regarded as part of the period, rather it comes under the ruling on istihaadah, so you have to wash your private parts with water and do wudoo’ for each prayer, and you should pray and fast, and not regard this as menstruation. You are also permissible for your husband, because Umm ‘Atiyyah (may Allaah be pleased with her) said: “We used to think that the brownish and yellowish discharge after the end of the period did not matter.” Narrated by al-Bukhaari in his Saheeh and by Abu Dawood; this version narrated by Abu Dawood).
From Majmoo’ Fataawa al-Shaykh Ibn Baaz, 10/207
And Allaah knows best.