Looks like someone tried to DYI and ran out of material! If you have something like this at your house, 1) it's probably illegal 2) it's probably unsanitary and 3) you need a plumber!
Call Advantage Plumbing, Heating & A/C for any of plumbing repair needs. 847-268-3553