Moved db connections to separate file

Added a require_once in all files needing it.