Chosen Solution

I have a Iphone 4s that I put a new battery in. I plugged it in to a charger after that, the apple logo came up then went away. I then plugged it into the computer (windows xp, without itunes), it connected fine and the computer said it was in dfu mode. So then I plugged it into a newercomputer with itunes, it connected for a second then disconnected. If I got the charging cord in the right spot it would stay connected for a little longer never more than like 5 seconds. The phone gets warm while on the charger.

It sounds to me like you either have a faulty battery or a bad charging port. I would try another charging port to see if this fixes the problem. If not, I would send the battery back for credit and try another battery. The possibility of getting a bad li-po battery is slim but it does happen from time to time.