Converting the depricated php mysql syntax into PDO

* Config file is fully rewritten
* Even more cleanup in this commit