Compare commits
2 commits
b1526d2b42
...
17c99c1e4c
Author | SHA1 | Date | |
---|---|---|---|
David Renner | 17c99c1e4c | ||
David Renner | 5bcfce5caa |
16
Katalog.htm
16
Katalog.htm
|
@ -31,7 +31,7 @@ Das war die alte version. -->
|
||||||
|
|
||||||
<div class="Eingabe">
|
<div class="Eingabe">
|
||||||
<h2>Eingabe</h2>
|
<h2>Eingabe</h2>
|
||||||
<form action="/php/catalogue_search.php">
|
<form action="./php/catalogue_search.php" method="POST">
|
||||||
<input type="text" name="Title" id="input" placeholder="Titel">
|
<input type="text" name="Title" id="input" placeholder="Titel">
|
||||||
<input type="text" name="Author" id="input" placeholder="Autor">
|
<input type="text" name="Author" id="input" placeholder="Autor">
|
||||||
<input type="text" name="Country" id="input" placeholder="Herkunft">
|
<input type="text" name="Country" id="input" placeholder="Herkunft">
|
||||||
|
@ -39,10 +39,20 @@ Das war die alte version. -->
|
||||||
<input type="text" name="Language" id="input" placeholder="Sprache">
|
<input type="text" name="Language" id="input" placeholder="Sprache">
|
||||||
<input type="number" name="Pages" id="input" placeholder="Seiten">
|
<input type="number" name="Pages" id="input" placeholder="Seiten">
|
||||||
<input type="date" name="Year" id="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY-->
|
<input type="date" name="Year" id="input" placeholder="Erscheinungsjahr"> <!-- Nur YYYY-->
|
||||||
<input type="text" name="Category" id="input" placeholder="Kategorie"> <!-- Nur Auswahl (per select?) -->
|
<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="url" name="ImageLink" id="input" placeholder="Bild">
|
||||||
<input type="number" name="LendTime" id="input" placeholder="Verteihdauer">
|
<input type="number" name="LendTime" id="input" placeholder="Verteihdauer">
|
||||||
<input type="text" name="LendType" id="input" placeholder="Verleihtyp">
|
<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">
|
<input type="submit" name="go" id="go">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
<?php
|
<?php
|
||||||
$form = array("Title"=>$_GET["Title"],array("Author"=>$_GET["Author"]);
|
$form = array("Title"=>$_POST["Title"],"Author"=>$_POST["Author"]);
|
||||||
<!DOCTYPE html>
|
$form = json_encode($form);
|
||||||
<html lang="en">
|
echo $form
|
||||||
<head>
|
?>
|
||||||
<meta charset="UTF-8">
|
</body>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
</html>
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
echo json_encode($form);
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
?>
|
|
||||||
|
|
58
php/pasta.php
Normal file
58
php/pasta.php
Normal 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>
|
Loading…
Reference in a new issue