Thanks for query,
if you pass pus
along with stool
and pain is present there is possibility of anal fistula
may be there in fistula on if you are having piles.
Go for rectal examination by surgeon.
Avoid fried,chillies and junk food.
Take plenty of fluid.
ok and bye.