info)) { $training = TrainingManager::getInstance($user->info['id'], false); try { $training->createDatabaseRecord(); $training->register([ new MyUserFirstQuest(), new ChatFirstStep() ]); } catch (TrainingException $e) { } if (!isset($data->token) || !password_verify( $training->getDatabaseData()['api_token'] . $data->time . $user->info['id'], $data->token )) { http_response_code(401); die; } if (isset($_GET['get'])) { switch ($_GET['get']) { default: http_response_code(400); die; case 'complete': if ($training->getDatabaseData()['data'][$training->getCurrentStepName()]['completed']) { http_response_code(400); die; } if($training->getRegistered()[$data->short_name]->isInfo()) { $training->addPoint($training->getCurrentStepName()); } $training->nextStep(); $training->store(); die(json_encode(['status' => 'ok'])); case 'go_back': $training->previousStep(); $training->store(); die(json_encode(['status' => 'ok', 'message' => 'Вы указал не верный ответ!'])); } } }