keep all of the scripts that have sensitive data in a directory that you don't allow your open source script see...
you should only have 1 script to connect to each database, and then just include them on the pages you need database access.
other than that, i don't see any other holes. other passwords should be encrypted and stored in the database, so nothing else should be hardcoded in the code