Finally fixed database connection for everything

Also changed all pages that access the database to get the connection
from connect.php so we only have to change one file in future.