moved from mysql to PDO

completly reworked database layer
make use of new global $conn in functions
moved from mysql to PDO

completly reworked database layer
make use of new global $conn in functions
merged back to master branch

resolved all conflicts