moved from mysql to PDO

completly reworked database layer
make use of new global $conn in functions