Core fixes

-Fixed some bugs (clients not closed on shutdown,  accounts not set to
loggedoff)
-Improved all database queries
-Login sanitary checks
-Started using more extensions
-Inventory will be added next commit