Fibinger Ádám
9 days ago c5946f44341c29594803c5b2ca64dcaf335fbca3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
 
include_once "common/base.php";
 
if (empty($_POST['json']))
{
    header('Location: /generator/form.php', true, 302);
}
$teams = new \EOG\Models\TeamList();
 
if (!$teams->fromJson($_POST['json']))
{
    echo "Nincs benne becsekkolt csapat.";
    return;
 
}
 
$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: " . TEAMS_JSON;
}