Modified database access in admin.php and public.php to fit with new Database object.