moved checkDb in a function and added controle config.php