Pain is your body's warning. That warning may be urgent (STOP IT!); that warning may be caution (I'm on the verge of something breaking here.); that warning may be indicative of disease or malfunction (I'm not right; you need to check me out.).
Listen to those signals.
If you're sore, then you need to recover. Sometimes, just flushing the area that hurts out is enough to fix it. Don't be an idiot, however, and ignore your body, and train extremely sore. It's dumb. You can, and will, get injured. You make gains in your RECOVERY and NOT in your training. Train smart. If you're so sore you have trouble moving around, take the day off, and next day, go easy. You should train with the view that you'll be doing it for a lifetime, and assess your risks with that in mind.
This is common sense. Do not train injured.
If your legs are real sore, ride a bike for a while, but, chill on the weights. Use those same sorts of methods with other body parts, too.
Stay hydrated. Make sure you EAT. Make sure you get enough rest.
Folks get injured when they do the "weekend warrior" mentality. You need to do the "every day" mentality, but, ease into it.