Purification and prayer for one who suffers from haemorrhoids
Question

                I have haemorrhoids. What should I do so that my prayer will be valid?.
Praise be to Allah.Firstly: 
Haemorrhoids refers to a 
    distension of the veins around the anal opening, and they may be internal or 
    external. Distension in the veins of the external part of the anus causes 
    external haemorrhoids, and distension in the veins of the internal part of 
    the anus causes internal haemorrhoids. 
Secondly: 
With regard to tahaarah 
    (purification), if the haemorrhoid is external, it does not invalidate 
    wudoo’ and it comes under the same ruling as boils. He has to clean his 
    garment and his body, but if that is too difficult for him, then he does not 
    have to wash his garment or change it, so as to ward off hardship and 
    difficulty. 
If it is internal but the 
    bleeding reaches the outside – if it is intermittent then it invalidates 
    wudoo’, but if it is continuous then he should do wudoo’ – according to the 
    majority of scholars – after the time for prayer begins, and he comes under 
    the same ruling as one who suffers form urinary incontinence or istihaadah 
    (non-menstrual bleeding). 
Yahya ibn Sa’eed al-Ansaari 
    was asked about a man who had haemorrhoids which kept coming out and he 
    pushed them back with his hand. He said: If he has to do that every time, 
    then he does not have to do anything more than washing his hand. If that 
    happens a great deal and is frequent, then we do not think that he has to 
    wash his hand. It is like a calamity that has befallen him so he is excused, 
    like one who has an ulcer. 
Al-Mudawwanah, 
    p. 121. 
Ibn Abi Shaybah narrated in
    al-Musannaf (1/164) from al-Sha’bi that he was asked about a man who 
    had haemorrhoids, and he said: He should pray even if (blood) flows from his 
    head to his feet. 
Al-Nawawi (may Allaah have 
    mercy on him) said: 
He does not have to do 
    wudoo’ in the case of injury or haemorrhoids, unless it is coming from the 
    inside, in which case it invalidates wudoo’.  
Al-Majmoo’ 
    (2/541). 
Thirdly: 
With regard to praying: If 
    he is able to stand when praying, then he should do so, because standing in 
    an obligatory prayer is an essential part of the prayer, and there is no 
    difference of scholarly opinion on this point. If he is unable to stand 
    because of his sickness, then he should pray sitting down. If he cannot do 
    that, then he should pray lying on his side. This is what was stated by our 
    Prophet  (peace and blessings of Allaah be upon him) to the Sahaabi 
    ‘Imraan ibn Husayn, who suffered from haemorrhoids. 
It was narrated that 
    ‘Imraan ibn Husayn (may Allaah be pleased with him) said: I had haemorrhoids 
    so I asked the Prophet  (peace and blessings of Allaah be upon him) 
    about praying. He said: “Pray standing up, and if you cannot, then sitting, 
    and if you cannot, then on your side.” Narrated by al-Bukhaari (1066). 
It should be noted that if 
    he prays sitting or on his side, he will still have the full reward, and 
    nothing will be detracted from the reward for his prayer because of that. 
It was narrated that Abu 
    Moosa al-Ash’ari (may Allaah be pleased with him) said: The Messenger of 
    Allaah  (peace and blessings of Allaah be upon him) said: “If a person 
    falls sick or is travelling, there will be recorded for him (a reward) like 
    that for the deeds that he used to do when he was not travelling and was 
    healthy.” Narrated by al-Bukhaari (2834).