+
+ // Log the user in and send them to wp-admin:
+ if ( ! headers_sent() ) {
+ wp_set_auth_cookie( $result['user_id'], true, is_ssl() );
+ wp_redirect( admin_url() );
+ exit;
+ }
+
+ // If headers have already been sent, fall back to a "Success!" message:
+ display_header();