Improved php file for db connection