$provider_id = $gameprovider_model->get_privider_id_by_game_id($game_id); $chat_id = $gamechat_model->add_chat($game_id, $command_id, $provider_id); } // Активные юзеры $active_users = $command_model->get_active_users($command_id, $game_id); //$gameStart = date("M,d,Y,h:m:i", $gameInfo['game_sdate'] + 60*60*24*62); $question_model->can_complete_game($game_id, $command_id); // Порции с вопросами $current_portions = $question_model->get_current_portions($game_id, $command_id); $next_portion = $question_model->get_next_portion($game_id, $command_id); // Если порций больше нет, то завершаем игру if (count($current_portions) == 0 && count($next_portion) == 0) { $game_model->complete_game($game_id, $command_id); } foreach ($current_portions as &$portion) { $portion['usedhelps'] = $question_model->get_used_helps($portion['question_id'], $command_id); $help = $question_model->try_get_next_help($portion['question_id'], $command_id, $portion['portion_sdate'], $portion['usedhelps'][count($portion['usedhelps']) - 1]['help_date']); // Обработка ПОСТов посказок if ($_POST['use_help'] && $help['result'] == "button") { $help_id = $_POST['help_id'] ? $_POST['help_id'] : 0; if ($help['help']['help_id'] == $help_id) { $question_model->use_help($help_id, $command_id); header("Location: game.php?game_id=" . $game_id); exit; } // 1. Получить из ПОСТа id подсказки // 2. Проверить я вляется ли она нужной подсказкой // 3. Если является то использовать. } $portion['status'] = ""; if ($help == false) {