All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Among honouring the rites of Allaah, is honouring the Quran and respecting it by keeping it away from dirty and impure places.
It should be noted that if the questioner knows that there is magic in the toilet, he should take it out, undo it and then bury it as the Prophet did with the magic done to him by the Jew, Labeed Ibn Al-A'sam. 'Aa'ishah said to the Prophet : "Shall I take it out? He replied: "No. As far as I am concerned, Allaah cured me and protected me from its effect, but I fear that it will cause harm to other people." So, he ordered her to bury it." [Al-Bukhari] This narration is evidence that it is permissible to undo magic and bury it, and this invalidates its effect, and there is no need for the person to sprinkle water on which Ruqyah is performed over the magic in that toilet.
Allaah Knows best.