I removed the toilet in this bathroom because it kept rocking, and found that the flange was bent and worn. The flange was not bolted down, and there were lumps of grout underneath it. The only thing keeping the flange held down is what seems like a lead pipe. There was also a black plastic piece on top, which I was able to pop off with a screw driver. I removed the flange and grout with a cold chisel, but now I'm wondering how to repair all of it. The subfloor is concrete, with a tile floor.
Do I buy a similar flange (iron?), and how do I bolt it to the floor? Also, is the lead pipe supposed to be hammered on top of the flange, and what is the black plastic piece for?
Here are some pictures: