} else {
                if (isset($_POST["login"])) {
                    Users::editUser(new User($_POST["login"], $_POST["password"], $_POST["firstname"], $_POST["lastname"]));
                }
            }
        }
        if ($_POST["action"] == 'sendInsertForm') {
            if (isset($_FILES['image'])) {
                if (Movies::insertImage($_FILES["image"])) {
                    Movies::insertMovie(new Movie(0, $_POST["title"], $_POST["short_description"], $_POST["long_description"], $_POST["director"], $_POST["year"], $_FILES["image"]["name"]));
                }
            }
        }
        if ($_POST["action"] == 'sendDeleteForm') {
            if (isset($_POST["id"])) {
                Movies::deleteMovie($_POST["id"]);
            } else {
                if (isset($_POST["login"])) {
                    Users::deleteUser($_POST["login"]);
                }
            }
        }
        if ($_POST["action"] == 'sendSubscribeForm') {
            Users::insertUser(new User($_POST["login"], password_hash($_POST["password"], PASSWORD_DEFAULT), $_POST["firstname"], $_POST["lastname"]));
        }
        header('Location: .');
        exit;
    }
} catch (Exception $e) {
    header('Location: .?error=' . $e->getMessage());
}