Praise be to Allah.
A woman does not sin just because sexual thoughts cross her mind, so long as they are not accompanied by doing or looking at (anything haraam), or turn into resolve to do something. That is because of the reports which indicate that a person is forgiven for his or her thoughts. It was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “Allaah has forgiven my ummah for whatever crosses their mind so long as they do not speak of it or act upon it.” Narrated by al-Bukhaari (2528) and Muslim (127).
Al-Nawawi (may Allaah have mercy on him) said, commenting on this hadeeth: A person’s thoughts, so long as he does not persist in them or dwell on them, are forgiven according to scholarly consensus, because he has no control over them occurring and there is no way that he can be free of all thoughts. End quote from al-Adhkaar (p. 345).
And he said: The reason why what we have mentioned is forgiven is because it is difficult to avoid it; what is possible is to avoid persisting in it. Hence continuing to think of it and resolving to do it is haraam.
Undoubtedly giving one’s mind free reign to continue thinking of these things may lead to one doing haraam things, in order to fulfil one’s desires, so a person may end up masturbating or looking at haraam images and so on.
Hence you should stop thinking about these things and divert your thoughts from them, and occupy yourself with acts of worship and obedience to Allaah, and things that will benefit you in your religious and worldly affairs.
See also the answer to question no. 20161.
Madhiy is usually emitted when desire is provoked. It is naajis and invalidates wudoo’, but its najaasah is light and it is sufficient to wash the private part and sprinkle the clothes with water in order to purify it.
If madhiy is emitted due to a mere passing thought, then one is not sinning.
If you were unaware of the ruling on madhiy and that it invalidates wudoo’, and you offered some prayers when it was present, then your prayers are valid according to the more correct view, because you were excused due to your not knowing.
This also applies to one who is unaware of some of the things that invalidate wudoo’, such as one who is unaware that eating camel meat invalidates wudoo’, then he prays. His prayer is valid.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: based on this, if a person does not purify himself as required because the text has not reached him – such as if he eats camel meat and does not do wudoo’, then the texts reaches him and it becomes clear to him that wudoo’ is obligatory in this case, or he prays in a camel pen because the text has not reached him and has not become clear to him – does he have to repeat past prayers? There are two opinions concerning this, both of which were narrated from Ahmad.
A similar case is if he touches his penis and prays, then he is told that it is obligatory to do wudoo’ after touching the penis.
The correct view in all these cases is that it is not obligatory to repeat the prayers, because Allaah forgives mistakes and forgetfulness, and because He says (interpretation of the meaning): “And We never punish until We have sent a Messenger (to give warning)” [al-Isra’ 17:15]. If the command of the Messenger (peace and blessings of Allaah be upon him) concerning a specific matter has not reached a person, then the ruling that it is obligatory has not been proven to him. Hence when ‘Umar and ‘Ammaar became junub and ‘Umar did not pray whilst ‘Ammaar prayed after rolling in the dust, the Prophet (peace and blessings of Allaah be upon him) did not tell either of them to repeat the prayer. Similarly, when Abu Dharr became junub and did not pray for several days, he did not tell him to make up the prayers; and he did not tell the Sahaabah who ate until the white thread became distinct from the black to make up that fast; and he did not tell those who prayed facing Jerusalem before news of the abrogation to make up those prayers reached them.
This also includes the woman who suffers from istihaadah (non-menstrual vaginal bleeding) who does not pray for a while, because she thinks that prayer is not obligatory for her. There are two views as to whether making up the prayers is obligatory for her, one of which is that she does not have to make them up, as was narrated from Maalik and others, because when the woman who suffered from istihaadah said to the Prophet (peace and blessings of Allaah be upon him): “I have been bleeding severely, heavily and awfully, and it prevented me from praying and fasting,” he told her what she had to do in the future, and he did not tell her to make up past prayers. End quote from Majmoo’ al-Fataawa (21/101).
We ask Allaah to guide you, forgive you and protect you.
And Allaah knows best.