refactoring some js
refactor of php classes to connect to mysql via cleaner PDO API.