2023-05-26 16:39:10 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta lang="de"/>
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
|
|
|
|
<link rel="Stylesheet" type="text/css" href="style.css"/>
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
|
|
<title>Candle Bibliothek | Löschen Erfolgreich Meine Bücher</title>
|
|
|
|
<link rel="icon" href="pictures/candle.png">
|
|
|
|
<script src="burgerIcon.js"></script>
|
2023-06-12 10:30:40 +02:00
|
|
|
<script src="notwendiges_laden.js" defer></script>
|
2023-05-26 16:39:10 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2023-06-12 16:17:49 +02:00
|
|
|
<header id="header">
|
|
|
|
<h1 class="kopf" >
|
|
|
|
<br><br>
|
|
|
|
Bibliothek
|
|
|
|
<a href="index.php" id="bildID">
|
|
|
|
<img id="CandleID" src="pictures/candle.png"
|
|
|
|
alt="Bild von einer Kerze" width="200" height="192"/></a>
|
|
|
|
<br><br>
|
|
|
|
Candle
|
|
|
|
</h1>
|
|
|
|
<div>
|
|
|
|
<a id="uberuns" href="uberuns.php">Über Uns</a>
|
|
|
|
<a id="buecher" href="buecher.php">Bücher</a>
|
|
|
|
<a id="meinebuecher" href="anmelden_meinebuecher.php">
|
|
|
|
Meine Bücher</a>
|
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
if(isset($_SESSION["eingeloggt"]) && $_SESSION["eingeloggt"] == 1 ){
|
|
|
|
echo "<a id='abmelden' href='abmelden.php'>Abmelden</a>";}
|
|
|
|
?>
|
|
|
|
<form action="suchergebnisse.php">
|
|
|
|
<input type="hidden" name="searchType" value="simple">
|
|
|
|
<input name="searchFor" class="suchleiste" type="search"
|
|
|
|
placeholder="Suche...">
|
|
|
|
<button type="submit" id="buttonID" class="searchButton">
|
|
|
|
<i class="fa fa-search"></i>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
<a id="erweitertesuche" href="erweitertesuche.php">
|
|
|
|
Erweiterte Suche</a>
|
2023-06-14 20:31:11 +02:00
|
|
|
<a href="warenkorb.php" id="warenKorbID">
|
2023-06-12 16:17:49 +02:00
|
|
|
<img id="shoppingCard" src="pictures/einkaufswagen.png"
|
|
|
|
alt="Bild von einem Wagen" width="50" height="50"/>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</header>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-14 20:01:56 +02:00
|
|
|
<?php
|
2023-06-14 21:29:16 +02:00
|
|
|
|
2023-06-14 20:31:11 +02:00
|
|
|
$BookID = $_GET['buchID'];
|
2023-06-14 21:29:16 +02:00
|
|
|
|
2023-06-14 20:01:56 +02:00
|
|
|
$servername = "localhost";
|
|
|
|
$username = "web_b-3";
|
|
|
|
$password = "een7Ao6s";
|
|
|
|
$dbname = "bibliothek_candle";
|
|
|
|
|
|
|
|
$connection =
|
|
|
|
mysqli_connect($servername, $username, $password, $dbname);
|
|
|
|
|
|
|
|
if (!$connection) {
|
|
|
|
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
|
|
|
}
|
2023-06-14 21:29:16 +02:00
|
|
|
|
|
|
|
$sqlDelete = $connection->prepare("
|
|
|
|
DELETE FROM `ausgeliehenes_buch` WHERE `ausgeliehenes_buch`.`AusleihID` = ?;");
|
|
|
|
$sqlDelete->bind_param("i", $ID);
|
|
|
|
$ID = $_GET['ausleihID'];
|
|
|
|
// SQL-Befehl ausführen
|
|
|
|
$sqlDelete->execute();
|
|
|
|
|
|
|
|
$sqlGetQuantity = $connection->prepare(
|
|
|
|
"SELECT Anzahl, MaxAnzahl FROM `buch` WHERE BuchID = ?;");
|
|
|
|
$sqlGetQuantity->bind_param("i", $BookID);
|
|
|
|
$sqlGetQuantity->execute();
|
|
|
|
// Ergebnis speichern
|
|
|
|
$resultGetQuantity = $sqlGetQuantity->get_result();
|
|
|
|
if (mysqli_num_rows($resultGetQuantity) > 0) {
|
|
|
|
while($rowGetQuantity = mysqli_fetch_assoc($resultGetQuantity)) {
|
|
|
|
$bookQuantity = $rowGetQuantity['Anzahl'];
|
|
|
|
$bookMaxQuantity = $rowGetQuantity['MaxAnzahl'];
|
|
|
|
$bookTempQuantity = $bookQuantity + 1;
|
|
|
|
$bookTempQuantityNew = $bookMaxQuantity - $bookTempQuantity;
|
|
|
|
|
|
|
|
$sqlGetBorrowedQuantity = $connection->prepare(
|
|
|
|
"SELECT COUNT(*) AS Ausgeliehen
|
|
|
|
FROM `ausgeliehenes_buch` WHERE BuchID = ?;"
|
|
|
|
);
|
|
|
|
$sqlGetBorrowedQuantity->bind_param("i", $BookID);
|
|
|
|
$sqlGetBorrowedQuantity->execute();
|
|
|
|
// Ergebnis speichern
|
|
|
|
$resultGetBorrowedQuantity = $sqlGetBorrowedQuantity->get_result();
|
|
|
|
if (mysqli_num_rows($resultGetBorrowedQuantity) > 0) {
|
|
|
|
while($rowGetBorrowedQuantity = mysqli_fetch_assoc($resultGetBorrowedQuantity)) {
|
|
|
|
$bookBorrowedQuantity = $rowGetBorrowedQuantity['Ausgeliehen'];
|
|
|
|
|
|
|
|
if ($bookBorrowedQuantity == $bookTempQuantityNew) {
|
|
|
|
$sqlUpdateBook = $connection->prepare(
|
|
|
|
"UPDATE buch SET Anzahl = Anzahl+1
|
|
|
|
WHERE buch.BuchID = ? ;"
|
|
|
|
);
|
|
|
|
$sqlUpdateBook->bind_param("i", $BookID);
|
|
|
|
$sqlUpdateBook->execute();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sqlGetBorrowedID = $connection->prepare(
|
|
|
|
"SELECT AusleihID
|
|
|
|
FROM `ausgeliehenes_buch`
|
|
|
|
WHERE BuchID = ?
|
|
|
|
AND Reserviert=1
|
|
|
|
ORDER BY Enddatum
|
|
|
|
DESC LIMIT 1;"
|
|
|
|
);
|
|
|
|
$sqlGetBorrowedID->bind_param("i", $BookID);
|
|
|
|
$sqlGetBorrowedID->execute();
|
|
|
|
// Ergebnis speichern
|
|
|
|
$resultGetBorrowedID = $sqlGetBorrowedID->get_result();
|
|
|
|
if (mysqli_num_rows($resultGetBorrowedID) > 0) {
|
|
|
|
while($rowGetBorrowedID = mysqli_fetch_assoc($resultGetBorrowedID)) {
|
|
|
|
$bookBorrowedID = $rowGetBorrowedID['AusleihID'];
|
|
|
|
$sqlUpdateBookID = $connection->prepare(
|
|
|
|
"UPDATE `ausgeliehenes_buch`
|
|
|
|
SET `Verlängerbar` = '1',
|
|
|
|
`Reserviert` = '0'
|
|
|
|
WHERE `ausgeliehenes_buch`.`AusleihID` = ?;"
|
|
|
|
);
|
|
|
|
$sqlUpdateBookID->bind_param("i", $bookBorrowedID);
|
|
|
|
$sqlUpdateBookID->execute();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-06-14 20:01:56 +02:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
2023-05-26 16:39:10 +02:00
|
|
|
<div class="hauptcontainer" id="verlängerung">
|
|
|
|
<h1 id="verlängerungH1">Buch erfolgreich entfernt</h1>
|
|
|
|
<div id="verlängerungContent">
|
|
|
|
<p id="möchten-sie">Die Reservierung wurde erfolgreich aufgehoben.</p>
|
|
|
|
|
|
|
|
<div id="verlängerungButtonContainer">
|
2023-05-31 13:51:15 +02:00
|
|
|
<a id = "verlängerungErfolgreichButton1" href="meinebuecher.php">Zurück zum Warennkorb</a>
|
2023-05-26 16:39:10 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--Link JS file-->
|
|
|
|
<!--If it was small and got big, it calls the function only one time and doesn't do it all the time-->
|
2023-06-14 12:04:25 +02:00
|
|
|
<script src="resize.js"></script>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-12 11:23:37 +02:00
|
|
|
<nav id="activeid" class="active"></nav>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-12 10:30:40 +02:00
|
|
|
<footer id="footer" class="fuss" ></footer>
|
2023-05-26 16:39:10 +02:00
|
|
|
</body>
|
|
|
|
|
2023-05-31 13:51:15 +02:00
|
|
|
</html>
|