0, 'error' => 'Kein Server ausgewählt' ] ) ); } if ( empty( $idLong ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Keine Identität ausgewählt' ] ) ); } if ( empty( $_REQUEST['id'] ) || empty( $_REQUEST['credential'] ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Daten unvollständig: ' . var_export( $_REQUEST, TRUE ) ] ) ); } $msg = new ParTCP_Outgoing_Message( $serverLong, $idLong, 'registration' ); $msg->set_date(); $msg->set( 'Participant-Id', $_REQUEST['id'] ); $msg->set( 'Credential', hash( 'sha256', $_REQUEST['credential'] ) ); if ( ! empty( $_REQUEST['credential_permanence'] ) ){ $msg->set( 'Credential-Permanence', $_REQUEST['credential_permanence'] ); } if ( ! empty( $_REQUEST['flags'] ) ){ $msg->set( 'Flags', array_map( 'trim', explode( "\n", trim( $_REQUEST['flags'] ) ) ) ); } if ( ! empty( $_REQUEST['attributes'] ) ){ $lines = explode( "\n", $_REQUEST['attributes'] ); $attr = []; foreach ( $lines as $line ){ $parts = array_map( 'trim', explode( ':', $line ) ); if ( ! empty( $parts[1] ) ){ $attr[ $parts[0] ] = $parts[1]; } } $msg->set( 'Attributes', $attr, TRUE ); } if ( ! empty( $_REQUEST['consent_statement'] ) ){ $msg->set( 'Consent-Statement', $_REQUEST['consent_statement'] ); } $response = pas_check_response( $msg->send() ); if ( is_string( $response ) ){ die( json_encode( [ 'status' => 0, 'error' => $response ] ) ); } echo json_encode( [ 'status' => 1, 'error' => '', 'redirect' => "{$BaseUrl}/participant/{$_REQUEST['id']}" ] ); // end of file ajax/create_participant.php