Fibinger Ádám
2019-11-10 cb9ca2b735b9fedc479799e88ddb731251b35b08
commit | author | age
b40e93 1 <?php
2
3 include_once "common/base.php";
4
cb9ca2 5 if (empty($_POST['json']))
6 {
7     header('Location: /generator/form.php', true, 302);
b40e93 8 }
9 $teams = new \EOG\Models\TeamList();
10
cb9ca2 11 if (!$teams->fromJson($_POST['json']))
12 {
13     echo "Nincs benne becsekkolt csapat.";
14     return;
15
16 }
17
b40e93 18 $success = false;
19
cb9ca2 20 $success = file_put_contents(TEAMS_JSON, $teams->getJson());
21
22 if (!$success)
23 {
24     var_dump($teams->getJson());
25     var_dump(is_writable(TEAMS_JSON));
b40e93 26 }
27
cb9ca2 28 if ($success)
29 {
30     header('Location: /generator/form.php', true, 302);
b40e93 31 }
cb9ca2 32 else
33 {
34     echo "Szar van a palacsintában: " . TEAMS_JSON;
35 }