This commit is contained in:
Naumann 2020-06-08 15:00:19 +02:00
parent ac101f66d3
commit 55f68639b8
5 changed files with 196 additions and 5 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>

View file

@ -14,7 +14,7 @@
<div class="Eingabe"> <div class="Eingabe">
<h2>Eingabe</h2> <h2>Eingabe</h2>
<form action="catalogue_search.php"> <form action="catalogue_search.php" method="POST">
<input type="text" name="Title" class="input" placeholder="Titel"> <input type="text" name="Title" class="input" placeholder="Titel">
<input type="text" name="Author" class="input" placeholder="Autor"> <input type="text" name="Author" class="input" placeholder="Autor">
<input type="text" name="Country" class="input" placeholder="Herkunft"> <input type="text" name="Country" class="input" placeholder="Herkunft">
@ -23,10 +23,10 @@
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0"> <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="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"> <select class="input" name="Category">
<option>Book</option> <option value="Book">Book</option>
<option>Magazin</option> <option value="Magazin">Magazin</option>
<option>EBook</option> <option value="EBook">EBook</option>
<option>EPaper</option> <option value="EPaper">EPaper</option>
</select> </select>
<input type="url" name="ImageLink" class="input" placeholder="Bild"> <input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer"min ="0"> <input type="number" name="LendTime" class="input" placeholder="Verteihdauer"min ="0">

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>

9
php/catalogue_search.php Normal file
View file

@ -0,0 +1,9 @@
<html>
<body>
<?php
$form = array("Title"=>$_POST["Title"],"Author"=>$_POST["Author"]);
$form = json_encode($form);
// echo $form
?>
</body>
</html>

58
php/pasta.php Normal file
View file

@ -0,0 +1,58 @@
<?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]);
}
}
}
?>
<html>
<head>
<title>Test Link</title>
</head>
<body>
<?php if(isset($response)) { echo $response; } ?>
<form method="post">
<label for="link">Link</label>
<input id="link" type="text" name="link" />
</form>
</body>
</html>