From 9ad6876181faaff4d1d4333d5f09c4769fd9217e Mon Sep 17 00:00:00 2001
From: Yannic Error: " . $e->getMessage() . " Book added successfully! Error: " . $e->getMessage() . " Borrowers added! Error: " . $e->getMessage() . " Loan added! Error: " . $e->getMessage() . "'; print_r($result); echo '
';
+ }
+}
+?>
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..cb78cf6
--- /dev/null
+++ b/index.php
@@ -0,0 +1,449 @@
+
+
+
+
+
+
+ Bücherei Verwaltung
+
+
+
+
+
+ Neues Buch hinzufügen
+
+
+
+ Neue Exemplare hinzufügen
+
+
+
+ Ausleiher hinzufügen
+
+
+
+ Buch verleihen
+
+
+
+ Buch einsammeln
+
+
+
+
+
+ Verliehene Bücher
+
+
+ Vorname Nachname Klasse/Funktion Buch Exemplar Ausleihdatum Rückgabe fällig
+
+
+
+
+ = htmlspecialchars($loan['firstName'])?>
+ = htmlspecialchars($loan['lastName'])?>
+ = htmlspecialchars($loan['borrowerRole'])?>
+ = htmlspecialchars($loan['bookTitle'])?>
+ #= htmlspecialchars($loan['copyID'])?>
+ = date_create($loan['borrowedDate'])->format("d.m.Y")?>
+ = date_create($loan['dueDate'])->format("d.m.Y")?>
+
+
+ Versäumte Rückgaben
+
+
+ Vorname Nachname Klasse/Funktion Buch Exemplar Ausleihdatum Rückgabe fällig
+
+
+
+
+ = htmlspecialchars($lateLoan['firstName'])?>
+ = htmlspecialchars($lateLoan['lastName'])?>
+ = htmlspecialchars($lateLoan['borrowerRole'])?>
+ = htmlspecialchars($lateLoan['bookTitle'])?>
+ #= htmlspecialchars($lateLoan['copyID'])?>
+ = date_create($lateLoan['borrowedDate'])->format("d.m.Y")?>
+ = date_create($lateLoan['dueDate'])->format("d.m.Y")?>
+
+
+
+
+ Datenbank durchsuchen
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..ffe95ab
--- /dev/null
+++ b/style.css
@@ -0,0 +1,9 @@
+*{
+ font-family: arial;
+}
+
+td, th{
+ border: 1px solid black;
+ vertical-align: top;
+ padding: 10px;
+}
\ No newline at end of file
diff --git a/submission.php b/submission.php
new file mode 100644
index 0000000..60c012b
--- /dev/null
+++ b/submission.php
@@ -0,0 +1,126 @@
+Please fill in all fields.
Please fill in all fields.
"; + } + } + + //Borrower Submission + if($_POST['submissionType'] == "borrower"){ + $firstname = $_POST['firstname'] ?? ''; + $lastname = $_POST['lastname'] ?? ''; + $role = $_POST['role'] ?? ''; + + if($firstname && $lastname && $role){ + addBorrower($pdo, $firstname, $lastname, $role); + }else{ + echo "Please fill in all fields.
"; + } + } + + if($_POST['submissionType'] == "loan"){ + $copyID = $_POST['copyID'] ?? ''; + $borrowerID = $_POST['borrowerID'] ?? ''; + $borrowedDate = $_POST['borrowedDate'] ?? ''; + $dueDate = $_POST['dueDate']; + + if($copyID && $borrowerID && $borrowedDate && $dueDate){ + addLoan($pdo, $copyID, $borrowerID, $borrowedDate, $dueDate); + }else{ + echo "Please fill in all fields.
"; + } + } + + if($_POST['submissionType'] == "return"){ + $copyIDLoanID = explode("-", $_POST['copyID-loanID'], 2); + + $copyID = $copyIDLoanID[0]; + $loanID = $copyIDLoanID[1]; + $returnedDate = $_POST['returnedDate']; + + if($copyID && $loanID){ + removeLoan($pdo, $copyID, $loanID, $returnedDate); + }else{ + echo "Please fill in all fields
"; + } + } + + if($_POST['submissionType'] == "selectRequest"){ + $selectRequest = $_POST['sqlSelectTextarea']; + + if($selectRequest){ + selectRequest($pdo, $selectRequest); + }else{ + echo "Please fill in all fields
"; + } + } +} + +if($_SERVER['REQUEST_METHOD'] == 'GET'){ + + if(!hash_equals($sessionToken, $getToken)){ + die("Invalid request: Token mismatch."); + } + + if($_GET['submissionType'] == "getCopies"){ + $bookID = $_GET['bookID']; + if($bookID){ + $copies = getAvailableCopiesOfBook($pdo, $bookID); + + echo json_encode($copies); + }else{ + echo json_encode([]); + } + } + + if($_GET['submissionType'] == "getReturnCopies"){ + $borrowerID = $_GET['borrowerID']; + if($borrowerID){ + $copies = getBorrowedCopiesOfBorrower($pdo, $borrowerID); + + echo json_encode($copies); + }else{ + echo json_encode([]); + } + } +} +?> \ No newline at end of file