Compare commits

...

21 Commits

Author SHA1 Message Date
Naumann 560252464b - 2020-06-12 08:57:44 +02:00
Naumann 438122dbc9 . 2020-06-11 13:27:04 +02:00
Naumann cbcc2d9217 it works! (findKatalog) 2020-06-11 11:48:57 +02:00
Naumann 9069b58ae2 test 2020-06-10 15:24:05 +02:00
Naumann bc5ab4adc9 tested pasta 2020-06-10 14:32:20 +02:00
Naumann 4bf926b8e3 a few tests 2020-06-10 10:35:44 +02:00
Naumann f3551ee100 a few changes and tests 2020-06-10 10:22:49 +02:00
Naumann 26069bb314 small bug fix 2020-06-09 14:46:10 +02:00
Naumann e244196c4b just some cleanup 2020-06-09 14:24:56 +02:00
Naumann 085c62f199 . 2020-06-09 13:32:38 +02:00
Naumann e70c6210b0 encode and decode json example 2020-06-09 12:40:49 +02:00
Naumann 9d9bc2c1e1 input text can be displayed in table (just a test) 2020-06-09 11:32:44 +02:00
Naumann 5425028d5f Merge remote-tracking branch 'origin/David' 2020-06-09 08:10:13 +02:00
Naumann c6ba2a9ec5 . 2020-06-09 08:05:04 +02:00
Naumann fb411e2db4 Merge remote-tracking branch 'origin/master' into Felix 2020-06-08 15:00:34 +02:00
Naumann 55f68639b8 . 2020-06-08 15:00:19 +02:00
David Renner 4b44a540a6 ... 2020-06-08 14:42:06 +02:00
David Renner 104a749340 more php done. 2020-06-08 14:05:05 +02:00
David Renner 17c99c1e4c . 2020-06-08 12:41:39 +02:00
David Renner 5bcfce5caa form data to json per php works! 2020-06-08 12:33:06 +02:00
David Renner b1526d2b42 first "form to json" php 2020-06-08 10:10:08 +02:00
17 changed files with 947 additions and 74 deletions

113
Katalog.htm Normal file
View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Katalog</title>
<link rel="stylesheet" type="text/css" href="scss/Style.css" media="screen" />
</head>
<body>
<div class="Titel">
<h1>Katalog</h1>
</div>
<!--
<div class="Eingabe">
<h2>Eingabe</h2>
<textarea name="Titel" class="text" placeholder="Titel"></textarea>
<textarea name="Author" class="text" placeholder="Author"></textarea>
<textarea name="Country" class="text" placeholder="Country"></textarea>
<textarea name="Link" class="text" placeholder="Link"></textarea>
<textarea name="Language" class="text" placeholder="Language"></textarea>
<textarea name="Pages" class="text" type="number" placeholder="Pages"></textarea>
<textarea name="Year" class="text" type="number" placeholder="Year"></textarea>
<textarea name="Category" class="text" placeholder="Category"></textarea>
<textarea name="ImageLink" class="text" placeholder="ImageLink"></textarea>
<textarea name="LendTime" class="text" type="number" placeholder="LendTime"></textarea>
<textarea name="LendType" class="text" placeholder="LendType"></textarea>
<button id="go">Go</button>
</div>
Das war die alte version. -->
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="./php/catalogue_search.php" method="POST">
<input type="text" name="Title" id="input" placeholder="Titel">
<input type="text" name="Author" id="input" placeholder="Autor">
<input type="text" name="Country" id="input" placeholder="Herkunft">
<input type="url" name="Link" id="input" placeholder="Link">
<input type="text" name="Language" id="input" placeholder="Sprache">
<input type="number" name="Pages" id="input" placeholder="Seiten">
<input type="date" name="Year" id="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY-->
<input list="categories" name="Category" id="input" placeholder="Kategorie"> <!-- Nur Auswahl (per select?) -->
<datalist id="categories">
<option value="Buch">
<option value="Magazin">
<option value="E-Book">
<option value="e-Magazin">
</datalist>
<input type="url" name="ImageLink" id="input" placeholder="Bild">
<input type="number" name="LendTime" id="input" placeholder="Verteihdauer">
<input list="types" name="LendType" id="input" placeholder="Verleihtyp">
<datalist id="types">
<option value="Physisch">
<option value="Virtuell">
</datalist>
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ProductId</td>
<td>1</td>
</tr>
<tr>
<td class="fix">Titel</td>
<td>Die Bibel 2</td>
</tr>
<tr>
<td class="fix">Author</td>
<td>Mr. IchBinEinAuthor</td>
</tr>
<tr>
<td class="fix">Contry</td>
<td>Atlantis</td>
</tr>
<tr>
<td class="fix">Link</td>
<td>lmgtfy.de</td>
</tr>
<tr>
<td class="fix">Language</td>
<td>latein</td>
</tr>
<tr>
<td class="fix">Pages</td>
<td>42</td>
</tr>
<tr>
<td class="fix">Year</td>
<td>2021</td>
</tr>
<tr>
<td class="fix">Category</td>
<td>Dies ist ein Beispiel für einen viiiiiiiiiiiiiiiiieeeeeeeeeeeeeeeellllllllllllllllllll zzzzzuuuuuuuuu llllllllllllaaaaaaaaannnnnnnnnnggeeeeeeeennnnnnn TTTTTTeeeeeeeeeeeeeeexxxxxxxxxxxxt</td>
</tr>
<tr>
<td class="fix">ImageLink</td>
<td>DiesIstEinBild.png</td>
</tr>
<tr>
<td class="fix">LendTime</td>
<td>30</td>
</tr>
<tr>
<td class="fix">LendType</td>
<td>Buch</td>
</tr>
</table>
</div>
</body>
</html>

61
add.php Normal file
View File

@ -0,0 +1,61 @@
<?php
if(isset($_GET['test'])) {
$link = "https://localhost:5000/api/katalog/42";
//remove protocol, we're assuming its http
if(strstr($link, '://') != false){
$link = substr($link, strpos($link,'://') + strlen('://'));
}
//split the url into host (www.example.com) and requested page (index.php) on the first slash
$host = substr($link, 0, strpos($link, '/'));
$request = substr($link, strpos($link, '/'));
//open a socket connection to the site on port 80 (http protocol port)
$fp = @fsockopen($host, 80, $errno, $errstr);
if($fp == false){
$response = $errno . " " . $errstr;
}
else {
//create the request headers
$headers = array();
$headers[] = 'HEAD ' . $request . ' HTTP/1.1';
$headers[] = 'Host: ' . $host;
//$headers[] = 'Content-Length: 0';
$headers[] = 'Connection: close';
$headers[] = 'Content-Type: text/html';
$headers = implode("\r\n", $headers) . "\r\n\r\n";
//send our request
if (!fwrite($fp, $headers)) {
fclose($fp);
$response = "Could not access webpage specified.";
}
else {
//read the response
$rsp = '';
while(!feof($fp)) { $rsp .= fgets($fp,8192); }
fclose($fp);
echo $rsp;
/*
$hunks = explode("\r\n\r\n",trim($rsp));
$headers = explode("\n", $hunks[count($hunks) - 1]);
$response = trim($headers[0]);
*/
}
}
}
?>
<html>
<head>
<title>Test Link</title>
</head>
<body>
<?php if(isset($response)) { echo $response; } ?>
<form method="get">
<input type="submit" name="list">
</form>
<button method= "get" type="button" name="test">Don't!!</button>
</body>
</html>

View File

@ -14,14 +14,14 @@
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="catalogue_search.php">
<form action="php/pasta.php" method="POST">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
<input type="url" name="Link" class="input" placeholder="Link">
<input type="text" name="Language" class="input" placeholder="Sprache">
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="date" name="Year" class="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY--> <!--funktioniert nur über ein Skript, alternativ type="number" mit min und max restrictions-->
<input type="number" name="Year" class="input" placeholder="Erscheinungsjahr" min="0">
<select class="input" name="Category">
<option>Book</option>
<option>Magazin</option>

222
addKatalog.php Normal file
View File

@ -0,0 +1,222 @@
<?php /*
if(isset($_POST["go"]))
{
$form = array(
"Title"=>$_POST["Title"],
"Author"=>$_POST["Author"]);
$json = json_encode($form);
//echo $json;
// Dieser Schritt dient nur um die Daten wieder in der Ausgabe anzeigen zu lassen,
//muss später noch an eine andere Stelle gepackt werden (z.B. nach dem Empfang von Daten aus der API)
$json2= json_decode($json, true);
} */
?>
<?php
/*fsockopen('www.google.com', 80);
//Zugriff auf API
if(isset($_POST["go"]))
{
$Title= $_POST['Title'];
$url= "https://localhost:5001/api/katalog"; // stimmt die URL?
$client = curl_init($url);
$result= file_get_contents($url);
//$fp = @fsockopen($client, 80, $errno, $errstr);
$response=curl_exec($url);
echo $errstr;
//echo $fp;
echo $response;
$result = json_decode($response);
echo $result;
$form = array(
"Title"=>$_POST["Title"],
"Author"=>$_POST["Author"]);
$json = json_encode($form);
// Dieser Schritt dient nur um die Daten wieder in der Ausgabe anzeigen zu lassen,
//muss später noch an eine andere Stelle gepackt werden 8z.B. nach dem Empfang von Daten aus der API)
$json2= json_decode($json, true);
}*/
?>
<?php /*
//nur zum Test einer GET-Methode
if(isset($_GET["test"]))
{
$url= "http://localhost:5000/api/katalog/1";
$contents = file_get_contents($url);
if($contents !== false){
//Print out the contents.
echo $contents;
}
//$client = curl_init($url);
//$response=curl_exec($client);
$Title= $_GET['Title'];
$result = json_decode($response);
echo $result['title'];
}*/
?>
<?php
if(isset($_POST["go"]))
{
$form = array(
"title"=>$_POST["Title"],
"author"=>$_POST["Author"],
"country"=>$_POST["Country"],
"link"=>$_POST["Link"],
"language"=>$_POST["Language"],
"pages"=>$_POST["Pages"],
"year"=>$_POST["Year"],
"category"=>$_POST["Category"],
"imageLink"=>$_POST["ImageLink"],
"lendTime"=>$_POST["LendTime"],
"lendType"=>$_POST["LendType"]);
$json = json_encode($form);
//echo $form["title"];
$context = stream_context_create(array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => "POST",
'content' => $json
)
));
// Send the request
$response= file_get_contents('http://localhost:5000/api/katalog/buch', true, $context);
echo $response;
// Check for errors
if($response === FALSE){
echo('Error!');
}
// Decode the response
$responseData = json_decode($response, TRUE);
// Print the date from the response
echo $responseData['productId'];
//$data = $form;
/*
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => http_build_query($form),
),
);
$context = stream_context_create($options);
//echo $context;
// $result = file_get_contents('http://localhost:5000/api/katalog/');
//$bloed= file_put_contents('http://localhost:5000/api/katalog/', $form, FILE_APPEND);
*/
// http://www.php.net/manual/en/context.http.php
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Katalog</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Katalog</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="post">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
<input type="url" name="Link" class="input" placeholder="Link">
<input type="text" name="Language" class="input" placeholder="Sprache">
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="number" name="Year" class="input" placeholder="Erscheinungsjahr" min="0">
<select class="input" name="Category">
<option value="0">Book</option>
<option value="1">Magazin</option>
<option value="2" >EBook</option>
<option value="3">EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min="0">
<select class="input" name="LendType">
<option value="0">Physical</option>
<option value="1">Virtual</option>
</select>
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ProductId</td>
<td> </td>
</tr>
<tr>
<td class="fix">Titel</td>
<td><?php if(isset($_POST["go"])) echo $json2['Title']; ?></td>
</tr>
<tr>
<td class="fix">Autor</td>
<td><?php if(isset($_POST["go"])) echo $json2['Author']; ?></td>
</tr>
<tr>
<td class="fix">Land</td>
<td></td>
</tr>
<tr>
<td class="fix">Link</td>
<td></td>
</tr>
<tr>
<td class="fix">Sprache</td>
<td></td>
</tr>
<tr>
<td class="fix">Seitenzahl</td>
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td></td>
</tr>
<tr>
<td class="fix">Kategorie</td>
<td></td>
</tr>
<tr>
<td class="fix">Bildlink</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihdauer</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihtyp</td>
<td></td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -14,7 +14,7 @@
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="catalogue_search.php">
<form action="php/catalogue_search.php" method="POST">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
@ -23,14 +23,14 @@
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="date" name="Year" class="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY--> <!--funktioniert nur über ein Skript, alternativ type="number" mit min und max restrictions-->
<select class="input" name="Category">
<option>Book</option>
<option>Magazin</option>
<option>EBook</option>
<option>EPaper</option>
<option value="Book">Book</option>
<option value="Magazin">Magazin</option>
<option value="EBook">EBook</option>
<option value="EPaper">EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer"min ="0">
<select class="input" name="Category">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min ="0">
<select class="input" name="LendType">
<option>Physical</option>
<option>Virtual</option>
</select>

View File

@ -1,24 +1,45 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verleih</title>
<title>Katalog</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Verleih</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="lend_search.php">
<input type="number" name="VerleihId" class="input" placeholder="Geben sie die gesuchte VerleihId an" min= "0">
<input type="submit" name="go" id="go">
</form>
<h1>Katalog</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="php/catalogue_search.php" method="POST">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
<input type="url" name="Link" class="input" placeholder="Link">
<input type="text" name="Language" class="input" placeholder="Sprache">
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="date" name="Year" class="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY--> <!--funktioniert nur über ein Skript, alternativ type="number" mit min und max restrictions-->
<select class="input" name="Category">
<option value="Book">Book</option>
<option value="Magazin">Magazin</option>
<option value="EBook">EBook</option>
<option value="EPaper">EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min ="0">
<select class="input" name="LendType">
<option>Physical</option>
<option>Virtual</option>
</select>
<!--<input type="submit" name="go" id="go">-->
<input type="button" name="test" >
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
@ -35,7 +56,7 @@
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsland</td>
<td class="fix">Land</td>
<td></td>
</tr>
<tr>
@ -51,7 +72,7 @@
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td class="fix">Jahr</td>
<td></td>
</tr>
<tr>

View File

@ -1,3 +1,9 @@
<?php
$form = array("Title"=>$_POST["Title"],"Author"=>$_POST["Author"]);
$form = json_encode($form);
echo $form
?>
<!DOCTYPE html>
<html lang="de">
<head>
@ -11,14 +17,32 @@
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Katalog</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="catalogue_search.php">
<input type="number" name="ProductId" class="input" placeholder="Geben sie die gesuchte ProduktId an" min= "0">
<form action="php/catalogue_search.php" method="POST">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
<input type="url" name="Link" class="input" placeholder="Link">
<input type="text" name="Language" class="input" placeholder="Sprache">
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="date" name="Year" class="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY--> <!--funktioniert nur über ein Skript, alternativ type="number" mit min und max restrictions-->
<select class="input" name="Category">
<option value="Book">Book</option>
<option value="Magazin">Magazin</option>
<option value="EBook">EBook</option>
<option value="EPaper">EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min ="0">
<select class="input" name="LendType">
<option>Physical</option>
<option>Virtual</option>
</select>
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
@ -35,7 +59,7 @@
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsland</td>
<td class="fix">Land</td>
<td></td>
</tr>
<tr>
@ -51,7 +75,7 @@
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td class="fix">Jahr</td>
<td></td>
</tr>
<tr>
@ -67,7 +91,7 @@
<td></td>
</tr>
<tr>
<td class="fix">Verleihart</td>
<td class="fix">Verleihtyp</td>
<td></td>
</tr>
</table>

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventar</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Inventar</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="inventar_search.php">
<input type="number" name="ProductId" class="input" placeholder="Geben Sie die gesuchte Id an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ItemId</td>
<td></td>
</tr>
<tr>
<td class="fix">BookId</td>
<td></td>
</tr>
</table>
</div>
</body>
</html>

61
findInventar.php Normal file
View File

@ -0,0 +1,61 @@
<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/inventar';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["ItemId"];
$result = file_get_contents('http://localhost:5000/api/inventar/'.$id);
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventar</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Inventar</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="post">
<input type="number" name="ItemId" class="input" placeholder="Geben Sie die gesuchte Id an" min= "1">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">BookId</td>
<td><?php if(isset($_POST["go"])) echo $json['bookId']; ?></td>
</tr>
</table>
</div>
</body>
</html>

102
findKatalog.php Normal file
View File

@ -0,0 +1,102 @@
<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/katalog';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["ProductId"];
$result = file_get_contents('http://localhost:5000/api/katalog/'.$id);
//echo $result;
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Katalog</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Katalog</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="post">
<input type="number" name="ProductId" class="input" placeholder="Geben Sie die gesuchte ProduktId an" min= "1" required>
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ProductId</td>
<td><?php if(isset($_POST["go"])) echo $json['productId']; ?></td>
</tr>
<tr>
<td class="fix">Titel</td>
<td><?php if(isset($_POST["go"])) echo $json['title']; ?></td>
</tr>
<tr>
<td class="fix">Autor</td>
<td><?php if(isset($_POST["go"])) echo $json['author']; ?></td>
</tr>
<tr>
<td class="fix">Erscheinungsland</td>
<td><?php if(isset($_POST["go"])) echo $json['country']; ?></td>
</tr>
<tr>
<td class="fix">Link</td>
<td><?php if(isset($_POST["go"])) echo $json['link']; ?></td>
</tr>
<tr>
<td class="fix">Sprache</td>
<td><?php if(isset($_POST["go"])) echo $json['language']; ?></td>
</tr>
<tr>
<td class="fix">Seitenzahl</td>
<td><?php if(isset($_POST["go"])) echo $json['pages']; ?></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td><?php if(isset($_POST["go"])) echo $json['year']; ?></td>
</tr>
<tr>
<td class="fix">Kategorie</td>
<td><?php if(isset($_POST["go"])) echo $json['category']; ?></td>
</tr>
<tr>
<td class="fix">Bildlink</td>
<td><?php if(isset($_POST["go"])) echo $json['imageLink']; ?></td>
</tr>
<tr>
<td class="fix">Verleihdauer</td>
<td><?php if(isset($_POST["go"])) echo $json['lendTime']; ?></td>
</tr>
<tr>
<td class="fix">Verleihart</td>
<td><?php if(isset($_POST["go"])) echo $json['lendType']; ?></td>
</tr>
</table>
</div>
</body>
</html>

73
findVerleih.php Normal file
View File

@ -0,0 +1,73 @@
<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/leihvorgang';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["id"];
$result = file_get_contents('http://localhost:5000/api/leihvorgang/'.$id);
//echo $result;
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verleih</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Verleih</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form methode="post">
<input type="number" name="id" class="input" placeholder="Geben sie die gesuchte VerleihId an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">Id</td>
<td><?php if(isset($_POST["go"])) echo $json['id']; ?></td>
</tr>
<tr>
<td class="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">ReturnDate</td>
<td><?php if(isset($_POST["go"])) echo $json['returnDate']; ?></td>
</tr>
<tr>
<td class="fix">Customer</td>
<td><?php if(isset($_POST["go"])) echo $json['customer']; ?></td>
</tr>
<tr>
<td class="fix">Returned</td>
<td><?php if(isset($_POST["go"])) echo $json['returned']; ?></td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -19,10 +19,10 @@
<select name="selection" id="selection" onchange="location.assign(this.value);">
<option></option>
<option value=findKatalog.htm>Finden</option>
<Option value="addKatalog.htm">Hinzufügen</Option>
<option value="changeKatalog.htm">Bearbeiten</option>
<option value="deleteKatalog.htm">Löschen</option>
<option value=findKatalog.php>Finden</option>
<Option value="addKatalog.php">Hinzufügen</Option>
<option value="changeKatalog.php">Bearbeiten</option>
<option value="deleteKatalog.php">Löschen</option>
</select>
</dd>
<dt>
@ -32,9 +32,9 @@
<select name="selection" id="selection" onchange="location.assign(this.value);">
<option></option>
<option value=findInventar.htm>Finden</option>
<Option value="addInventar.htm">Hinzufügen</Option>
<option value="deleteInventar.htm">Löschen</option>
<option value=findInventar.php>Finden</option>
<Option value="addInventar.php">Hinzufügen</Option>
<option value="deleteInventar.php">Löschen</option>
</select>
</dd>
<dt>
@ -44,9 +44,9 @@
<select name="selection" id="selection" onchange="location.assign(this.value);">
<option></option>
<option value=findVerleih.htm>Finden</option>
<Option value="addVerleih.htm">Hinzufügen</Option>
<option value="changeVerleih.htm">Bearbeiten</option>
<option value=findVerleih.php>Finden</option>
<Option value="addVerleih.php">Hinzufügen</Option>
<option value="changeVerleih.php">Bearbeiten</option>
</select>
</dd>
</form>

142
php/Catalougeadd.php Normal file
View File

@ -0,0 +1,142 @@
<?php
if(isset($_POST['link'])) {
$link = $_POST['link'];
//remove protocol, we're assuming its http
if(strstr($link, '://') != false){
$link = substr($link, strpos($link,'://') + strlen('://'));
}
//split the url into host (www.example.com) and requested page (index.php) on the first slash
$host = substr($link, 0, strpos($link, '/'));
$request = substr($link, strpos($link, '/'));
//open a socket connection to the site on port 80 (http protocol port)
$fp = @fsockopen($host, 80, $errno, $errstr);
if($fp == false){
$response = $errno . " " . $errstr;
}
else {
//create the request headers
$headers = array();
$headers[] = 'HEAD ' . $request . ' HTTP/1.1';
$headers[] = 'Host: ' . $host;
$headers[] = 'Content-Length: 0';
$headers[] = 'Connection: close';
$headers[] = 'Content-Type: text/html';
$headers = implode("\r\n", $headers) . "\r\n\r\n";
//send our request
if (!fwrite($fp, $headers)) {
fclose($fp);
$response = "Could not access webpage specified.";
}
else {
//read the response
$rsp = '';
while(!feof($fp)) { $rsp .= fgets($fp,8192); }
fclose($fp);
$hunks = explode("\r\n\r\n",trim($rsp));
$headers = explode("\n", $hunks[count($hunks) - 1]);
$response = trim($headers[0]);
}
}
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Katalog</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Katalog</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="POST">
<input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft">
<input type="url" name="Link" class="input" placeholder="Link">
<input type="text" name="Language" class="input" placeholder="Sprache">
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="number" name="Year" class="input" placeholder="Erscheinungsjahr" min="0">
<select class="input" name="Category">
<option>Book</option>
<option>Magazin</option>
<option>EBook</option>
<option>EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min="0">
<select class="input" name="Category">
<option>Physical</option>
<option>Virtual</option>
</select>
<input type="submit" name="go" id="go">
</form>
<?php if(isset($response)) { echo $response; } ?>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ProductId</td>
<td></td>
</tr>
<tr>
<td class="fix">Titel</td>
<td></td>
</tr>
<tr>
<td class="fix">Autor</td>
<td></td>
</tr>
<tr>
<td class="fix">Land</td>
<td></td>
</tr>
<tr>
<td class="fix">Link</td>
<td></td>
</tr>
<tr>
<td class="fix">Sprache</td>
<td></td>
</tr>
<tr>
<td class="fix">Seitenzahl</td>
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td></td>
</tr>
<tr>
<td class="fix">Kategorie</td>
<td></td>
</tr>
<tr>
<td class="fix">Bildlink</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihdauer</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihtyp</td>
<td></td>
</tr>
</table>
</div>
</body>
</html>

11
php/catalogue_read.php Normal file
View File

@ -0,0 +1,11 @@
<html>
<?php
$obj = $_POST;
$form = json_decode($obj);
foreach($form as $key=>$value){
echo $key.": ".$value."[br]";
}
?>
</html>

17
php/catalogue_search.php Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
$form = array(
"Title"=>$_POST["Title"],
"Author"=>$_POST["Author"]);
$json = json_encode($form);
echo $json;
?>
</body>
</html>

62
php/pasta.php Normal file
View File

@ -0,0 +1,62 @@
<?php
if(isset($_GET['link'])) {
$link = $_GET['link'];
//remove protocol, we're assuming its http
if(strstr($link, '://') != false){
$link = substr($link, strpos($link,'://') + strlen('://'));
}
//split the url into host (www.example.com) and requested page (index.php) on the first slash
$host = substr($link, 0, strpos($link, '/'));
$request = substr($link, strpos($link, '/'));
//open a socket connection to the site on port 80 (http protocol port)
$fp = @fsockopen($host, 80, $errno, $errstr);
if($fp == false){
$response= "Hallo";
$response = $errno . " " . $errstr;
}
else {
//create the request headers
$headers = array();
$headers[] = 'HEAD ' . $request . ' HTTP/1.1';
$headers[] = 'Host: ' . $host;
//$headers[] = 'Content-Length: 0';
$headers[] = 'Connection: close';
$headers[] = 'Content-Type: application/json; charset=utf-8';
$headers = implode("\r\n", $headers) . "\r\n\r\n";
//send our request
if (!fwrite($fp, $headers)) {
fclose($fp);
$response = "Hallo.";
}
else {
//read the response
$rsp = '';
while(!feof($fp)) { $rsp .= fgets($fp,8192); }
fclose($fp);
/*
$hunks = explode("\r\n\r\n",trim($rsp));
$headers = explode("\n", $hunks[count($hunks) - 1]);
$response = trim($headers[0]);*/
$response= $rsp;
}
}
}
?>
<html>
<head>
<title>Test Link</title>
</head>
<body>
<?php if(isset($response)) { echo $response; } ?>
<form method="get">
<label for="link">Link</label>
<input id="link" type="text" name="link" />
</form>
</body>
</html>

View File

@ -31,7 +31,8 @@ body
resize: none;
overflow: auto;
width: 90%;
height: 3%;
height: 5%;
margin-top: 10px;
margin-left: 5%;
}
#go