Remove mysqli use

This replaces mysqli use with PDO hardcoded to mysql.
remove spyware
create directory recursively
some more db rework