| | |
| | | |
| | | include_once "common/base.php"; |
| | | |
| | | if (empty($_POST['json'])) { |
| | | if (empty($_POST['json'])) |
| | | { |
| | | header('Location: /generator/form.php', true, 302); |
| | | } |
| | | $teams = new \EOG\Models\TeamList(); |
| | | |
| | | $success = false; |
| | | if (!$teams->fromJson($_POST['json'])) |
| | | { |
| | | echo "Nincs benne becsekkolt csapat."; |
| | | return; |
| | | |
| | | if ($teams->fromJson($_POST['json'])) { |
| | | $success = file_put_contents(OVERLAY_DIR . 'teams.json', $teams->getJson()); |
| | | } |
| | | |
| | | if ($success) { |
| | | $success = false; |
| | | |
| | | $success = file_put_contents(TEAMS_JSON, $teams->getJson()); |
| | | |
| | | if (!$success) |
| | | { |
| | | var_dump($teams->getJson()); |
| | | var_dump(is_writable(TEAMS_JSON)); |
| | | } |
| | | |
| | | if ($success) |
| | | { |
| | | header('Location: /generator/form.php', true, 302); |
| | | } else { |
| | | echo "Szar van a palacsintában"; |
| | | } |
| | | else |
| | | { |
| | | echo "Szar van a palacsintában: " . TEAMS_JSON; |
| | | } |