added security checks to make sure only admin can access the admin panel and its sub pages