Create and use app_login() and app_logout().
Add print_json().  It's stub right now until a come up with something nicer.