Im replacing a toilet and when I took the old one off the flange came with it. The bolts were completely corroded. It appears the flange wasnt even screwed down, there is no material around the pipe for a flange to be screwed into, I really have no idea how it was connected. So how am I going to get a new flange on there when there is a big gap between the pipe on the floor?

