[PHP-NOTES] note 130231 added to domdocument.registernodeclass

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
<?php
session_start();
require_once 'BookManager.php';

if (!isset($_SESSION['books'])) {
    $_SESSION['books'] = [
        ['id' => 1, 'title' => '1984', 'author' => 'George Orwell', 'year' => 1949],
        ['id' => 2, 'title' => 'Der Prozess', 'author' => 'Franz Kafka', 'year' => 1925],
        ['id' => 3, 'title' => 'Die Verwandlung', 'author' => 'Franz Kafka', 'year' => 1915]
    ];
}

$manager = new BookManager($_SESSION['books']);

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['create'])) {
        $manager->createBook($_POST['title'], $_POST['author'], (int)$_POST['year']);
    }
    if (isset($_POST['delete'])) {
        $manager->deleteBook((int)$_POST['id']);
    }

    $_SESSION['books'] = $manager->getAllBooks();
    header("Location: index.php");
    exit();
}

$books = $manager->getAllBooks();
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.27)
----
Manual Page -- https://php.net/manual/en/domdocument.registernodeclass.php
Edit        -- https://main.php.net/note/edit/130231
Del: integrated  -- https://main.php.net/note/delete/130231/integrated
Del: useless     -- https://main.php.net/note/delete/130231/useless
Del: bad code    -- https://main.php.net/note/delete/130231/bad+code
Del: spam        -- https://main.php.net/note/delete/130231/spam
Del: non-english -- https://main.php.net/note/delete/130231/non-english
Del: in docs     -- https://main.php.net/note/delete/130231/in+docs
Del: other reasons-- https://main.php.net/note/delete/130231
Reject      -- https://main.php.net/note/reject/130231
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.