Harry went back every day and would freely admit that he couldn't take his eyes off. He took every little detail of the mirror in, learning it's name the Mirror of Erised. It was only a matter of time before he got caught.