php code formatting
removed unused code
execute code by php interpreter
use config.inc.php for database settings
added license and author information
moved global settings to top of the file
added error handler
made code more readable