Code formatting.

This commit is contained in:
2023-12-28 13:31:44 +01:00
parent b65644f3e0
commit b70cedac3b
84 changed files with 3357 additions and 3280 deletions

View File

@@ -1,21 +1,20 @@
<?php
$file = "../img/angebot/".$_POST['Titel'].".jpg";
$sql2 = 'DELETE FROM Angebot WHERE ID = "'.$_POST['Titel'].'"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gelöscht</p>\n";
if (unlink($file)) {
echo "<p>Bild wurde gelöscht</p>\n";
}
else {
echo "<p>Fehler beim Löschen des Bildes</p>\n";
}
} else {
echo "Fehler beim Löschen";
}
echo '<a href="index.php?section=angebote">Zurück zur Übersicht</a>';
$file = "../img/angebot/" . $_POST['Titel'] . ".jpg";
$sql2 = 'DELETE FROM Angebot WHERE ID = "' . $_POST['Titel'] . '"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gel<EFBFBD>scht</p>\n";
if (unlink($file)) {
echo "<p>Bild wurde gel<EFBFBD>scht</p>\n";
} else {
echo "<p>Fehler beim L<>schen des Bildes</p>\n";
}
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="index.php?section=angebote">Zur<75>ck zur <20>bersicht</a>';
?>

View File

@@ -2,83 +2,86 @@
<?php
if (!isset($_POST['Speichern'])) {
echo "<img src=\"../img/angebot/".$_POST['Titel'].".jpg\" /><br />";
$sql1 = 'SELECT * FROM Angebot WHERE ID = "'.$_POST['Titel'].'"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo "<img src=\"../img/angebot/" . $_POST['Titel'] . ".jpg\" /><br />";
$sql1 = 'SELECT * FROM Angebot WHERE ID = "' . $_POST['Titel'] . '"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
?>
?>
<form action="index.php?section=angebote" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern" />
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
<label><3E>berschrift 1</label>
<input type="text" name="head1" value="<?php echo $nt1['head1']; ?>" />
<br />
<label><3E>berschrift 2</label>
<input type="text" name="head2" value="<?php echo $nt1['head2']; ?>" />
<br />
<label>Text</label>
<br />
<textarea name="text" cols="90" rows="10"><?php echo $nt1['text']; ?></textarea>
<br />
<p>Gültig für die Wohnungen:</p>
<label>Amelie</label>
<input type="checkbox" name="amelie" <?php if('1' == $nt1['amelie']){ echo "checked=\"checked\" "; }?> />
<br />
<label>Gaby</label>
<input type="checkbox" name="gaby" <?php if('1' == $nt1['gaby']){ echo "checked=\"checked\" "; }?> />
<br />
<label>Preis Wohnung Amelie</label>
<input type="text" name="preisA" value="<?php echo $nt1['preisA']; ?>" />
<br />
<label>Preis Wohnung Gaby</label>
<input type="text" name="preisG" value="<?php echo $nt1['preisG']; ?>" />
<br />
<label>Anzahl Personen</label>
<input type="text" name="Personen" value="<?php echo $nt1['Personen']; ?>" />
<br />
<label>Leistungen (durch Enter von einander trennen)</label>
<br />
<textarea name="Leistungen" cols="90" rows="10"><?php echo $nt1['Leistungen']; ?></textarea>
<br />
<label>Gültigkeit</label>
<input type="text" name="Valid" value="<?php echo $nt1['Valid']; ?>" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=angebote" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern"/>
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
<label><3E>berschrift 1</label>
<input type="text" name="head1" value="<?php echo $nt1['head1']; ?>"/>
<br/>
<label><3E>berschrift 2</label>
<input type="text" name="head2" value="<?php echo $nt1['head2']; ?>"/>
<br/>
<label>Text</label>
<br/>
<textarea name="text" cols="90" rows="10"><?php echo $nt1['text']; ?></textarea>
<br/>
<p>Gültig für die Wohnungen:</p>
<label>Amelie</label>
<input type="checkbox" name="amelie" <?php if ('1' == $nt1['amelie']) {
echo "checked=\"checked\" ";
} ?> />
<br/>
<label>Gaby</label>
<input type="checkbox" name="gaby" <?php if ('1' == $nt1['gaby']) {
echo "checked=\"checked\" ";
} ?> />
<br/>
<label>Preis Wohnung Amelie</label>
<input type="text" name="preisA" value="<?php echo $nt1['preisA']; ?>"/>
<br/>
<label>Preis Wohnung Gaby</label>
<input type="text" name="preisG" value="<?php echo $nt1['preisG']; ?>"/>
<br/>
<label>Anzahl Personen</label>
<input type="text" name="Personen" value="<?php echo $nt1['Personen']; ?>"/>
<br/>
<label>Leistungen (durch Enter von einander trennen)</label>
<br/>
<textarea name="Leistungen" cols="90" rows="10"><?php echo $nt1['Leistungen']; ?></textarea>
<br/>
<label>Gültigkeit</label>
<input type="text" name="Valid" value="<?php echo $nt1['Valid']; ?>"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$head1 = $_POST['head1'];
$head2 = $_POST['head2'];
$text = $_POST['text'];
if ("on" == $_POST['amelie']) {
$amelie = 1;
} else {
$amelie = 0;
}
if ("on" == $_POST['gaby']) {
$gaby = 1;
} else {
$gaby = 0;
}
$preisA = $_POST['preisA'];
$preisG = $_POST['preisG'];
$Personen = $_POST['Personen'];
$Leistungen = $_POST['Leistungen'];
$Valid = $_POST['Valid'];
$sql2 = 'UPDATE Angebot SET head1 = "'.$head1.'", head2 = "'.$head2.'", text = "'.$text.'", amelie = "'.$amelie.'", gaby = "'.$gaby.'", preisA = "'.$preisA.'", preisG = "'.$preisG.'", Personen = "'.$Personen.'", Leistungen = "'.$Leistungen.'", Valid = "'.$Valid.'" WHERE ID = "'.$_POST['id'].'";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt->error);
}
echo "Der Eintrag wurde ge<67>ndert<br />";
echo '<a href="index.php?section=angebote">Zur<75>ck zur <20>bersicht</a>';
<?php
} else {
$head1 = $_POST['head1'];
$head2 = $_POST['head2'];
$text = $_POST['text'];
if ("on" == $_POST['amelie']) {
$amelie = 1;
} else {
$amelie = 0;
}
if ("on" == $_POST['gaby']) {
$gaby = 1;
} else {
$gaby = 0;
}
$preisA = $_POST['preisA'];
$preisG = $_POST['preisG'];
$Personen = $_POST['Personen'];
$Leistungen = $_POST['Leistungen'];
$Valid = $_POST['Valid'];
$sql2 = 'UPDATE Angebot SET head1 = "' . $head1 . '", head2 = "' . $head2 . '", text = "' . $text . '", amelie = "' . $amelie . '", gaby = "' . $gaby . '", preisA = "' . $preisA . '", preisG = "' . $preisG . '", Personen = "' . $Personen . '", Leistungen = "' . $Leistungen . '", Valid = "' . $Valid . '" WHERE ID = "' . $_POST['id'] . '";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt->error);
}
echo "Der Eintrag wurde ge<67>ndert<br />";
echo '<a href="index.php?section=angebote">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -2,106 +2,105 @@
<?php
if (!isset($_POST['Speichern'])) {
?>
?>
<form action="index.php?section=angebote" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="new" value="speichern" />
<input type="file" name="Foto" />
<br />
<label>Überschrift 1</label>
<input type="text" name="head1" />
<br />
<label>Überschrift 2</label>
<input type="text" name="head2" />
<br />
<label>Text</label>
<br />
<textarea name="text" cols="90" rows="10"></textarea>
<br />
<p>Gültig für die Wohnungen:</p>
<label>Amelie</label>
<input type="checkbox" name="amelie" />
<br />
<label>Gaby</label>
<input type="checkbox" name="gaby" />
<br />
<label>Preis Wohnung Amelie</label>
<input type="text" name="preisA" />
<br />
<label>Preis Wohnung Gaby</label>
<input type="text" name="preisG" />
<br />
<label>Anzahl Personen</label>
<input type="text" name="Personen" />
<br />
<label>Leistungen (durch Enter von einander trennen)</label>
<br />
<textarea name="Leistungen" cols="90" rows="10"></textarea>
<br />
<label>G<>ltigkeit</label>
<input type="text" name="Valid" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=angebote" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="new" value="speichern"/>
<input type="file" name="Foto"/>
<br/>
<label>Überschrift 1</label>
<input type="text" name="head1"/>
<br/>
<label>Überschrift 2</label>
<input type="text" name="head2"/>
<br/>
<label>Text</label>
<br/>
<textarea name="text" cols="90" rows="10"></textarea>
<br/>
<p>Gültig für die Wohnungen:</p>
<label>Amelie</label>
<input type="checkbox" name="amelie"/>
<br/>
<label>Gaby</label>
<input type="checkbox" name="gaby"/>
<br/>
<label>Preis Wohnung Amelie</label>
<input type="text" name="preisA"/>
<br/>
<label>Preis Wohnung Gaby</label>
<input type="text" name="preisG"/>
<br/>
<label>Anzahl Personen</label>
<input type="text" name="Personen"/>
<br/>
<label>Leistungen (durch Enter von einander trennen)</label>
<br/>
<textarea name="Leistungen" cols="90" rows="10"></textarea>
<br/>
<label>G<>ltigkeit</label>
<input type="text" name="Valid"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
if ('' != $_FILES['Foto']['name']) {
$head1 = $_POST['head1'];
$head2 = $_POST['head2'];
$text = $_POST['text'];
if ("on" == $_POST['amelie']) {
$amelie = 1;
} else {
$amelie = 0;
}
if ("on" == $_POST['gaby']) {
$gaby = 1;
} else {
$gaby = 0;
}
$preisA = $_POST['preisA'];
$preisG = $_POST['preisG'];
$Personen = $_POST['Personen'];
$Leistungen = $_POST['Leistungen'];
$Valid = $_POST['Valid'];
$sql1 = 'INSERT INTO Angebot (ID, head1, head2, text, amelie, gaby, preisA, preisG, Personen, Leistungen, Valid) VALUES (NULL, "'.$head1.'", "'.$head2.'", "'.$text.'", "'.$amelie.'", "'.$gaby.'", "'.$preisA.'", "'.$preisG.'", "'.$Personen.'", "'.$Leistungen.'", "'.$Valid.'");';
$stmt1 = $db->prepare($sql1);
<?php
} else {
if ('' != $_FILES['Foto']['name']) {
$head1 = $_POST['head1'];
$head2 = $_POST['head2'];
$text = $_POST['text'];
if ("on" == $_POST['amelie']) {
$amelie = 1;
} else {
$amelie = 0;
}
if ("on" == $_POST['gaby']) {
$gaby = 1;
} else {
$gaby = 0;
}
$preisA = $_POST['preisA'];
$preisG = $_POST['preisG'];
$Personen = $_POST['Personen'];
$Leistungen = $_POST['Leistungen'];
$Valid = $_POST['Valid'];
$sql1 = 'INSERT INTO Angebot (ID, head1, head2, text, amelie, gaby, preisA, preisG, Personen, Leistungen, Valid) VALUES (NULL, "' . $head1 . '", "' . $head2 . '", "' . $text . '", "' . $amelie . '", "' . $gaby . '", "' . $preisA . '", "' . $preisG . '", "' . $Personen . '", "' . $Leistungen . '", "' . $Valid . '");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt1->error);
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt1->error);
}
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$uploaddir = '../img/angebot/';
$uploadfile = $uploaddir. $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);
if ($height > $width) {
$newheight=280;
$newwidth=($width/$height)*280;
} else {
$newwidth=280;
$newheight=($height/$width)*280;
}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp,$filename,80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir. $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=angebote">Zur<75>ck zur <20>bersicht</a>';
$uploaddir = '../img/angebot/';
$uploadfile = $uploaddir . $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width, $height) = getimagesize($uploadfile);
if ($height > $width) {
$newheight = 280;
$newwidth = ($width / $height) * 280;
} else {
$newwidth = 280;
$newheight = ($height / $width) * 280;
}
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp, $filename, 80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir . $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=angebote">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -1,89 +1,84 @@
<?php
if ('will' == $_GET['t']) {
$path = "../img/will/";
echo "<h2>Fotos auf der Seite Willkommen</h2>\n";
} elseif ('haus' == $_GET['t']) {
$path = "../img/haus/";
echo "<h2>Fotos auf der Seite Unser Haus</h2>\n";
} elseif ('lage' == $_GET['t']) {
$path = "../img/haus/lage/";
echo "<h2>Fotos auf der Seite Unser Haus - Lage</h2>\n";
} elseif ('geschichte' == $_GET['t']) {
$path = "../img/haus/geschichte/";
echo "<h2>Fotos auf der Seite Unser Haus - Geschichte</h2>\n";
} elseif ('gaby' == $_GET['t']) {
$path = "../img/gaby/";
echo "<h2>Fotos auf der Seite Wohnung Gaby</h2>\n";
} elseif ('amelie' == $_GET['t']) {
$path = "../img/amelie/";
echo "<h2>Fotos auf der Seite Wohnung Amelie</h2>\n";
}
if ('will' == $_GET['t']) {
$path = "../img/will/";
echo "<h2>Fotos auf der Seite Willkommen</h2>\n";
} elseif ('haus' == $_GET['t']) {
$path = "../img/haus/";
echo "<h2>Fotos auf der Seite Unser Haus</h2>\n";
} elseif ('lage' == $_GET['t']) {
$path = "../img/haus/lage/";
echo "<h2>Fotos auf der Seite Unser Haus - Lage</h2>\n";
} elseif ('geschichte' == $_GET['t']) {
$path = "../img/haus/geschichte/";
echo "<h2>Fotos auf der Seite Unser Haus - Geschichte</h2>\n";
} elseif ('gaby' == $_GET['t']) {
$path = "../img/gaby/";
echo "<h2>Fotos auf der Seite Wohnung Gaby</h2>\n";
} elseif ('amelie' == $_GET['t']) {
$path = "../img/amelie/";
echo "<h2>Fotos auf der Seite Wohnung Amelie</h2>\n";
}
$ref = "index.php?section=fotos&t=".$_GET['t'];
if (!isset($_GET['action'])) {
echo "<p>Auf ein vorhandenes Bild klicken um es zu löschen<br />";
echo "Auf einen Platzhalter klicken um ein neues Bild hochzuladen</p>";
for ($i=0; $i<10; $i++) {
$pic = $path.$i.".jpg";
if (file_exists($pic)) {
$link = $ref."&action=del&pic=".$i;
echo "<a href=\"$link\">";
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
echo "</a>\n";
}
else {
$link = $ref."&action=add&pic=".$i;
echo "<a href=\"$link\">";
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"../img/no.jpg\" />";
echo "</a>\n";
}
}
}
else {
if ('del' == $_GET['action']) {
$delfile = $path . $_GET['pic'] . ".jpg";
if (unlink($delfile)) {
echo "<p>Bild gelöscht</p>";
}
else {
echo "<p>Fehler beim Löschen</p>";
}
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zurück zur Übersicht</a>\n";
}
elseif ('add' == $_GET['action']) {
$ref .= "&action=speichern&pic=".$_GET['pic']
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="file" name="Foto" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
$ref = "index.php?section=fotos&t=" . $_GET['t'];
<?php
}
elseif ('speichern' == $_GET['action']) {
$uploadfile = $path. $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);
if ($height > $width) {
$newheight=480;
$newwidth=($width/$height)*480;
} else {
$newwidth=480;
$newheight=($height/$width)*480;
}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = $path . $_GET['pic'] . ".jpg";
imagejpeg($tmp,$filename,80);
imagedestroy($src);
imagedestroy($tmp);
unlink($path. $_FILES['Foto']['name']);
echo "<p>Bild hochgeladen</p>";
echo "<a href=\"index.php?section=fotos&t=".$_GET['t']."\">Zurück zur Übersicht</a>\n";
}
}
if (!isset($_GET['action'])) {
echo "<p>Auf ein vorhandenes Bild klicken um es zu l<>schen<br />";
echo "Auf einen Platzhalter klicken um ein neues Bild hochzuladen</p>";
for ($i = 0; $i < 10; $i++) {
$pic = $path . $i . ".jpg";
if (file_exists($pic)) {
$link = $ref . "&action=del&pic=" . $i;
echo "<a href=\"$link\">";
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
echo "</a>\n";
} else {
$link = $ref . "&action=add&pic=" . $i;
echo "<a href=\"$link\">";
echo "<img style=\"margin: 20px 20px 20px 20px; border: 2px solid red;\" src=\"../img/no.jpg\" />";
echo "</a>\n";
}
}
} else {
if ('del' == $_GET['action']) {
$delfile = $path . $_GET['pic'] . ".jpg";
if (unlink($delfile)) {
echo "<p>Bild gel<65>scht</p>";
} else {
echo "<p>Fehler beim L<>schen</p>";
}
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zur<75>ck zur <20>bersicht</a>\n";
} elseif ('add' == $_GET['action']) {
$ref .= "&action=speichern&pic=" . $_GET['pic']
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="file" name="Foto"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
} elseif ('speichern' == $_GET['action']) {
$uploadfile = $path . $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width, $height) = getimagesize($uploadfile);
if ($height > $width) {
$newheight = 480;
$newwidth = ($width / $height) * 480;
} else {
$newwidth = 480;
$newheight = ($height / $width) * 480;
}
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename = $path . $_GET['pic'] . ".jpg";
imagejpeg($tmp, $filename, 80);
imagedestroy($src);
imagedestroy($tmp);
unlink($path . $_FILES['Foto']['name']);
echo "<p>Bild hochgeladen</p>";
echo "<a href=\"index.php?section=fotos&t=" . $_GET['t'] . "\">Zur<75>ck zur <20>bersicht</a>\n";
}
}

View File

@@ -2,16 +2,13 @@
<?php
if (isset($_POST['add'])) {
include "inhalte/fotos/bilder/add.php";
}
elseif (isset($_POST['edit'])) {
include "inhalte/fotos/bilder/edit.php";
}
elseif (isset($_POST['del'])) {
include "inhalte/fotos/bilder/del.php";
}
else {
include "inhalte/fotos/bilder/standard.php";
}
if (isset($_POST['add'])) {
include "inhalte/fotos/bilder/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/fotos/bilder/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/fotos/bilder/del.php";
} else {
include "inhalte/fotos/bilder/standard.php";
}
?>

View File

@@ -1,59 +1,58 @@
<h3>Neues Bild hinzufügen</h3>
<h3>Neues Bild hinzuf<EFBFBD>gen</h3>
<?php
if (!isset($_POST['Speichern'])) {
?>
?>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="add" value="speichern" />
<input type="file" name="Foto" />
<br />
<label>Bildüberschrift</label>
<input type="text" name="Text" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="add" value="speichern"/>
<input type="file" name="Foto"/>
<br/>
<label>Bild<EFBFBD>berschrift</label>
<input type="text" name="Text"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
if ('' != $_FILES['Foto']['name']) {
$Text = $_POST['Text'];
$sql1 = 'INSERT INTO bilder (ID, Head) VALUES (NULL, "'.$Text.'");';
$stmt1 = $db->prepare($sql1);
<?php
} else {
if ('' != $_FILES['Foto']['name']) {
$Text = $_POST['Text'];
$sql1 = 'INSERT INTO bilder (ID, Head) VALUES (NULL, "' . $Text . '");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt1->error);
die ('Query konnte nicht ausgef<EFBFBD>hrt werden: ' . $stmt1->error);
}
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$uploaddir = '../img/umgebung/bilder/';
$uploadfile = $uploaddir. $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);
if ($height > $width) {
$newheight=460;
$newwidth=($width/$height)*460;
} else {
$newwidth=460;
$newheight=($height/$width)*460;
}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp,$filename,80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir. $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=fotos&t=bilder">Zurück zur Übersicht</a>';
$uploaddir = '../img/umgebung/bilder/';
$uploadfile = $uploaddir . $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width, $height) = getimagesize($uploadfile);
if ($height > $width) {
$newheight = 460;
$newwidth = ($width / $height) * 460;
} else {
$newwidth = 460;
$newheight = ($height / $width) * 460;
}
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp, $filename, 80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir . $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=fotos&t=bilder">Zur<EFBFBD>ck zur <EFBFBD>bersicht</a>';
}
?>

View File

@@ -1,39 +1,37 @@
<?php
if (!isset($_POST['Speichern'])) {
echo "<p>Dieses Bild löschen?</p>\n";
$file = "../img/umgebung/bilder/".$_POST['Titel'].".jpg";
echo "<img src=\"$file\"><br />\n";
$sql1 = 'SELECT * FROM bilder WHERE ID = "'.$_POST['Titel'].'"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo "<h3>$nt1[Head]</h3>";
?>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<input type="hidden" name="del" value="speichern" />
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
<input type="hidden" name="file" value="<?php echo $file; ?>" />
<br />
<input type="submit" name="Speichern" value="L<>schen" />
</form>
<?php
}
else {
$sql2 = 'DELETE FROM bilder WHERE ID = "'.$_POST['id'].'"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gelöscht</p>\n";
if (unlink($_POST['file'])) {
echo "<p>Bild wurde gelöscht</p>\n";
}
else {
echo "<p>Fehler beim Löschen des Bildes</p>\n";
}
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
echo "<p>Dieses Bild löschen?</p>\n";
$file = "../img/umgebung/bilder/" . $_POST['Titel'] . ".jpg";
echo "<img src=\"$file\"><br />\n";
$sql1 = 'SELECT * FROM bilder WHERE ID = "' . $_POST['Titel'] . '"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo "<h3>$nt1[Head]</h3>";
?>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<input type="hidden" name="del" value="speichern"/>
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
<input type="hidden" name="file" value="<?php echo $file; ?>"/>
<br/>
<input type="submit" name="Speichern" value="L<>schen"/>
</form>
<?php
} else {
$sql2 = 'DELETE FROM bilder WHERE ID = "' . $_POST['id'] . '"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gelöscht</p>\n";
if (unlink($_POST['file'])) {
echo "<p>Bild wurde gelöscht</p>\n";
} else {
echo "<p>Fehler beim Löschen des Bildes</p>\n";
}
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -3,36 +3,35 @@
<?php
if (!isset($_POST['Speichern'])) {
echo "<img src=\"../img/umgebung/bilder/".$_POST['Titel'].".jpg\" /><br />";
$sql1 = 'SELECT Head FROM bilder WHERE ID = "'.$_POST['Titel'].'"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo $nt1['Head'];
echo "<img src=\"../img/umgebung/bilder/" . $_POST['Titel'] . ".jpg\" /><br />";
$sql1 = 'SELECT Head FROM bilder WHERE ID = "' . $_POST['Titel'] . '"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo $nt1['Head'];
?>
?>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern" />
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
<label>Bildüberschrift</label>
<input type="text" name="Text" value="<?php echo $nt1['Head']; ?>" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=fotos&t=bilder" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern"/>
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
<label>Bildüberschrift</label>
<input type="text" name="Text" value="<?php echo $nt1['Head']; ?>"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$Text = $_POST['Text'];
$sql2 = 'UPDATE bilder SET Head = "'.$Text.'" WHERE ID = "'.$_POST['id'].'";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt->error);
}
echo "Die <20>berschrift wurde gespeichert<br />";
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
<?php
} else {
$Text = $_POST['Text'];
$sql2 = 'UPDATE bilder SET Head = "' . $Text . '" WHERE ID = "' . $_POST['id'] . '";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt->error);
}
echo "Die <20>berschrift wurde gespeichert<br />";
echo '<a href="index.php?section=fotos&t=bilder">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -3,30 +3,30 @@ $sql1 = 'SELECT * FROM bilder';
$result1 = $db->query($sql1);
?>
<fieldset>
<form action="index.php?section=fotos&t=bilder" method="post">
<fieldset>
<legend>neues Foto hochladen</legend>
<input type="submit" name="add" value="Hochladen" />
<br />
</fieldset>
<br />
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="'.$nt1['ID'].'">'.$nt1['ID'].' '.$nt1['Head'].'</option>';
}
?>
</select>
<br />
<fieldset>
<legend>Bildüberschrift eines Fotos ändern</legend>
<input type="submit" name="edit" value="Bearbeiten" />
<br />
</fieldset>
<br />
<fieldset>
<legend>bestehendes Foto löschen</legend>
<input type="submit" name="del" value="Löschen" />
<br />
</fieldset>
<form action="index.php?section=fotos&t=bilder" method="post">
<fieldset>
<legend>neues Foto hochladen</legend>
<input type="submit" name="add" value="Hochladen"/>
<br/>
</fieldset>
<br/>
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="' . $nt1['ID'] . '">' . $nt1['ID'] . ' ' . $nt1['Head'] . '</option>';
}
?>
</select>
<br/>
<fieldset>
<legend>Bild<EFBFBD>berschrift eines Fotos <EFBFBD>ndern</legend>
<input type="submit" name="edit" value="Bearbeiten"/>
<br/>
</fieldset>
<br/>
<fieldset>
<legend>bestehendes Foto l<EFBFBD>schen</legend>
<input type="submit" name="del" value="L<EFBFBD>schen"/>
<br/>
</fieldset>
</fieldset>

View File

@@ -1,68 +1,65 @@
<?php
$path = "../img/haus/wohn/";
$ref = "index.php?section=fotos&t=".$_GET['t'];
$ref = "index.php?section=fotos&t=" . $_GET['t'];
if (!isset($_GET['action'])) {
echo "<p>Auf ein Bild klicken um es zu ersetzen<br />";
echo "<p>Auf ein Bild klicken um es zu ersetzen<br />";
for ($i=0; $i<2; $i++) {
$pic = $path.$i.".jpg";
if (file_exists($pic)) {
$link = $ref."&action=add&pic=".$i;
if (0 == $i) {
echo "<p>Wohnung Gaby:</p>\n";
} else {
echo "<p>Wohnung Amelie:</p>\n";
}
echo "<a href=\"$link\">";
echo "<img style=\"border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
echo "</a>\n";
echo "<br />&nbsp;";
}
else {
$link = $ref."&action=add&pic=".$i;
echo "<a href=\"$link\">";
echo "<img style=\"border: 2px solid red;\" src=\"../img/no.jpg\" />";
echo "</a>\n";
}
}
}
else {
if ('add' == $_GET['action']) {
$ref .= "&action=speichern&pic=".$_GET['pic']
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="file" name="Foto" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<?php
}
elseif ('speichern' == $_GET['action']) {
$delfile = $path . $_GET['pic'] . ".jpg";
unlink($delfile);
$uploadfile = $path. $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);
if ($height > $width) {
$newheight=200;
$newwidth=($width/$height)*200;
} else {
$newwidth=200;
$newheight=($height/$width)*200;
}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = $path . $_GET['pic'] . ".jpg";
imagejpeg($tmp,$filename,80);
imagedestroy($src);
imagedestroy($tmp);
unlink($path. $_FILES['Foto']['name']);
echo "<p>Bild hochgeladen</p>";
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zurück zur Übersicht</a>\n";
}
for ($i = 0; $i < 2; $i++) {
$pic = $path . $i . ".jpg";
if (file_exists($pic)) {
$link = $ref . "&action=add&pic=" . $i;
if (0 == $i) {
echo "<p>Wohnung Gaby:</p>\n";
} else {
echo "<p>Wohnung Amelie:</p>\n";
}
echo "<a href=\"$link\">";
echo "<img style=\"border: 2px solid red;\" src=\"$pic\" width=\"100px\" height=\"100px\"/>";
echo "</a>\n";
echo "<br />&nbsp;";
} else {
$link = $ref . "&action=add&pic=" . $i;
echo "<a href=\"$link\">";
echo "<img style=\"border: 2px solid red;\" src=\"../img/no.jpg\" />";
echo "</a>\n";
}
}
} else {
if ('add' == $_GET['action']) {
$ref .= "&action=speichern&pic=" . $_GET['pic']
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="file" name="Foto"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
} elseif ('speichern' == $_GET['action']) {
$delfile = $path . $_GET['pic'] . ".jpg";
unlink($delfile);
$uploadfile = $path . $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width, $height) = getimagesize($uploadfile);
if ($height > $width) {
$newheight = 200;
$newwidth = ($width / $height) * 200;
} else {
$newwidth = 200;
$newheight = ($height / $width) * 200;
}
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename = $path . $_GET['pic'] . ".jpg";
imagejpeg($tmp, $filename, 80);
imagedestroy($src);
imagedestroy($tmp);
unlink($path . $_FILES['Foto']['name']);
echo "<p>Bild hochgeladen</p>";
echo "<a href=\"index.php?section=fotos&t=$_GET[t]\">Zur<75>ck zur <20>bersicht</a>\n";
}
}
?>

View File

@@ -1,21 +1,20 @@
<?php
$file = "../img/umgebung/gb/".$_POST['Titel'].".jpg";
$sql2 = 'DELETE FROM gb WHERE ID = "'.$_POST['Titel'].'"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gelöscht</p>\n";
if (unlink($file)) {
echo "<p>Bild wurde gelöscht</p>\n";
}
else {
echo "<p>Fehler beim Löschen des Bildes</p>\n";
}
} else {
echo "Fehler beim Löschen";
}
echo '<a href="index.php?section=gb">Zurück zur Übersicht</a>';
$file = "../img/umgebung/gb/" . $_POST['Titel'] . ".jpg";
$sql2 = 'DELETE FROM gb WHERE ID = "' . $_POST['Titel'] . '"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gel<EFBFBD>scht</p>\n";
if (unlink($file)) {
echo "<p>Bild wurde gel<EFBFBD>scht</p>\n";
} else {
echo "<p>Fehler beim L<>schen des Bildes</p>\n";
}
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="index.php?section=gb">Zur<75>ck zur <20>bersicht</a>';
?>

View File

@@ -1,46 +1,45 @@
<h3>Gästebucheintrag ändern</h3>
<h3>G<EFBFBD>stebucheintrag <EFBFBD>ndern</h3>
<?php
if (!isset($_POST['Speichern'])) {
echo "<img src=\"../img/umgebung/gb/".$_POST['Titel'].".jpg\" /><br />";
$sql1 = 'SELECT Autor, Text, Datum FROM gb WHERE ID = "'.$_POST['Titel'].'"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
echo "<img src=\"../img/umgebung/gb/" . $_POST['Titel'] . ".jpg\" /><br />";
$sql1 = 'SELECT Autor, Text, Datum FROM gb WHERE ID = "' . $_POST['Titel'] . '"';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
?>
?>
<form action="index.php?section=gb" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern" />
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>" />
<label>Autor</label>
<br />
<input type="text" name="Autor" value="<?php echo $nt1['Autor']; ?>" />
<br />
<label>Text</label>
<br />
<textarea name="Text" cols="90" rows="10"><?php echo $nt1['Text']; ?></textarea>
<br />
<label>Datum (YYYY-MM-TT)</label>
<br />
<input type="text" name="Datum" value="<?php echo $nt1['Datum']; ?>" />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=gb" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern"/>
<input type="hidden" name="id" value="<?php echo $_POST['Titel']; ?>"/>
<label>Autor</label>
<br/>
<input type="text" name="Autor" value="<?php echo $nt1['Autor']; ?>"/>
<br/>
<label>Text</label>
<br/>
<textarea name="Text" cols="90" rows="10"><?php echo $nt1['Text']; ?></textarea>
<br/>
<label>Datum (YYYY-MM-TT)</label>
<br/>
<input type="text" name="Datum" value="<?php echo $nt1['Datum']; ?>"/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$Autor = $_POST['Autor'];
$Text = $_POST['Text'];
$Datum = $_POST['Datum'];
$sql2 = 'UPDATE gb SET Autor = "'.$Autor.'", Text = "'.$Text.'", Datum = "'.$Datum.'" WHERE ID = "'.$_POST['id'].'";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt->error);
}
echo "Der Eintrag wurde geändert<br />";
echo '<a href="index.php?section=gb">Zurück zur Übersicht</a>';
<?php
} else {
$Autor = $_POST['Autor'];
$Text = $_POST['Text'];
$Datum = $_POST['Datum'];
$sql2 = 'UPDATE gb SET Autor = "' . $Autor . '", Text = "' . $Text . '", Datum = "' . $Datum . '" WHERE ID = "' . $_POST['id'] . '";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt->error);
}
echo "Der Eintrag wurde ge<67>ndert<br />";
echo '<a href="index.php?section=gb">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -1,67 +1,66 @@
<h3>neuen Gästebucheintrag anlegen</h3>
<h3>neuen G<EFBFBD>stebucheintrag anlegen</h3>
<?php
if (!isset($_POST['Speichern'])) {
?>
?>
<form action="index.php?section=gb" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="new" value="speichern" />
<input type="file" name="Foto" />
<br />
<label>Autor</label>
<input type="text" name="Autor" />
<br />
<label>Text</label>
<textarea name="Text" cols="90" rows="10"></textarea>
<br />
<label>Datum (YYYY-MM-TT)</label>
<input type="text" name="Datum" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=gb" method="post" enctype="multipart/form-data">
<label>Foto ausw&auml;hlen</label>
<input type="hidden" name="new" value="speichern"/>
<input type="file" name="Foto"/>
<br/>
<label>Autor</label>
<input type="text" name="Autor"/>
<br/>
<label>Text</label>
<textarea name="Text" cols="90" rows="10"></textarea>
<br/>
<label>Datum (YYYY-MM-TT)</label>
<input type="text" name="Datum"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
if ('' != $_FILES['Foto']['name']) {
$Autor = $_POST['Autor'];
$Text = $_POST['Text'];
$Datum = $_POST['Datum'];
$sql1 = 'INSERT INTO gb (ID, Autor, Text, Datum) VALUES (NULL, "'.$Autor.'", "'.$Text.'", "'.$Datum.'");';
$stmt1 = $db->prepare($sql1);
<?php
} else {
if ('' != $_FILES['Foto']['name']) {
$Autor = $_POST['Autor'];
$Text = $_POST['Text'];
$Datum = $_POST['Datum'];
$sql1 = 'INSERT INTO gb (ID, Autor, Text, Datum) VALUES (NULL, "' . $Autor . '", "' . $Text . '", "' . $Datum . '");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt1->error);
die ('Query konnte nicht ausgef<EFBFBD>hrt werden: ' . $stmt1->error);
}
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$sql2 = 'SELECT last_insert_id()';
$result2 = $db->query($sql2);
$last = $result2->fetch_assoc();
$id = $last['last_insert_id()'];
$uploaddir = '../img/umgebung/gb/';
$uploadfile = $uploaddir. $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width,$height)=getimagesize($uploadfile);
if ($height > $width) {
$newheight=200;
$newwidth=($width/$height)*200;
} else {
$newwidth=200;
$newheight=($height/$width)*200;
}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp,$filename,80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir. $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=gb">Zurück zur Übersicht</a>';
$uploaddir = '../img/umgebung/gb/';
$uploadfile = $uploaddir . $_FILES['Foto']['name'];
move_uploaded_file($_FILES['Foto']['tmp_name'], $uploadfile);
$src = imagecreatefromjpeg($uploadfile);
list($width, $height) = getimagesize($uploadfile);
if ($height > $width) {
$newheight = 200;
$newwidth = ($width / $height) * 200;
} else {
$newwidth = 200;
$newheight = ($height / $width) * 200;
}
$tmp = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$filename = $uploaddir . $id . ".jpg";
imagejpeg($tmp, $filename, 80);
imagedestroy($src);
imagedestroy($tmp);
unlink($uploaddir . $_FILES['Foto']['name']);
}
echo '<a href="index.php?section=gb">Zur<EFBFBD>ck zur <EFBFBD>bersicht</a>';
}
?>

View File

@@ -4,16 +4,16 @@
$table = "Kal_Amelie";
$ref = "index.php?section=kal&t=amelie";
if (isset($_POST['add'])) {
include "inhalte/kal/belegung/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/kal/belegung/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/kal/belegung/del.php";
} elseif (isset($_POST['view'])) {
include "inhalte/kal/belegung/view.php";
} else {
include "inhalte/kal/belegung/standard.php";
}
if (isset($_POST['add'])) {
include "inhalte/kal/belegung/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/kal/belegung/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/kal/belegung/del.php";
} elseif (isset($_POST['view'])) {
include "inhalte/kal/belegung/view.php";
} else {
include "inhalte/kal/belegung/standard.php";
}
?>

View File

@@ -2,34 +2,33 @@
<?php
if (!isset($_POST['Speichern'])) {
?>
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="add" value="speichern" />
<label>Mieter:</label>
<input type="text" name="Mieter" />
<br />
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Start" />
<br />
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Ende" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="add" value="speichern"/>
<label>Mieter:</label>
<input type="text" name="Mieter"/>
<br/>
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Start"/>
<br/>
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Ende"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$sql2 = 'INSERT INTO '.$table.' (ID, Mieter, Start, Ende) VALUES (NULL, "'.$_POST['Mieter'].'", "'.$_POST['Start'].'", "'.$_POST['Ende'].'");';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt1->error);
}
echo '<a href="'.$ref.'">Zur<75>ck zur <20>bersicht</a>';
<?php
} else {
$sql2 = 'INSERT INTO ' . $table . ' (ID, Mieter, Start, Ende) VALUES (NULL, "' . $_POST['Mieter'] . '", "' . $_POST['Start'] . '", "' . $_POST['Ende'] . '");';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt1->error);
}
echo '<a href="' . $ref . '">Zur<75>ck zur <20>bersicht</a>';
}

View File

@@ -1,13 +1,13 @@
<?php
$sql2 = 'DELETE FROM '.$table.' WHERE ID = "'.$_POST['Titel'].'"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gel<65>scht</p>\n";
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="'.$ref.'">Zur<75>ck zur <20>bersicht</a>';
$sql2 = 'DELETE FROM ' . $table . ' WHERE ID = "' . $_POST['Titel'] . '"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gel<65>scht</p>\n";
} else {
echo "Fehler beim L<>schen";
}
echo '<a href="' . $ref . '">Zur<75>ck zur <20>bersicht</a>';
?>

View File

@@ -1,41 +1,40 @@
<h3>Bestehende Belegung Ändern</h3>
<?php
$sql1 = 'SELECT * FROM '.$table.' WHERE ID = "'.$_POST['Titel'].'";';
$sql1 = 'SELECT * FROM ' . $table . ' WHERE ID = "' . $_POST['Titel'] . '";';
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
if (!isset($_POST['Speichern'])) {
var_dump($_POST);
echo "<br />";
?>
var_dump($_POST);
echo "<br />";
?>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="ID" value="<?php echo $_POST['Titel']; ?>" />
<input type="hidden" name="edit" value="speichern" />
<label>Mieter:</label>
<input type="text" name="Mieter" value="<?php echo $nt1['Mieter']; ?>" />
<br />
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Start" value="<?php echo $nt1['Start']; ?>" />
<br />
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Ende" value="<?php echo $nt1['Ende']; ?>" />
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="<?php echo $ref; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="ID" value="<?php echo $_POST['Titel']; ?>"/>
<input type="hidden" name="edit" value="speichern"/>
<label>Mieter:</label>
<input type="text" name="Mieter" value="<?php echo $nt1['Mieter']; ?>"/>
<br/>
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Start" value="<?php echo $nt1['Start']; ?>"/>
<br/>
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Ende" value="<?php echo $nt1['Ende']; ?>"/>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$sql2 = 'UPDATE '.$table.' SET Mieter = "'.$_POST['Mieter'].'", Start = "'.$_POST['Start'].'", Ende = "'.$_POST['Ende'].'" WHERE ID = "'.$_POST['ID'].'";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt1->error);
}
echo '<a href="'.$ref.'">Zur<75>ck zur <20>bersicht</a>';
<?php
} else {
$sql2 = 'UPDATE ' . $table . ' SET Mieter = "' . $_POST['Mieter'] . '", Start = "' . $_POST['Start'] . '", Ende = "' . $_POST['Ende'] . '" WHERE ID = "' . $_POST['ID'] . '";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt1->error);
}
echo '<a href="' . $ref . '">Zur<75>ck zur <20>bersicht</a>';
}

View File

@@ -1,38 +1,38 @@
<?php
$sql1 = 'SELECT * FROM '.$table.'';
$sql1 = 'SELECT * FROM ' . $table . '';
$result1 = $db->query($sql1);
?>
<fieldset>
<form action="<?php echo $ref; ?>" method="post">
<fieldset>
<legend>neue Belegung erstellen</legend>
<input type="submit" name="add" value="Erstellen" />
<br />
</fieldset>
<br />
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="'.$nt1['ID'].'">'.$nt1['Mieter'].' '.$nt1['Start'].'</option>';
}
?>
</select>
<br />
<fieldset>
<legend>Belegung bearbeiten</legend>
<input type="submit" name="edit" value="Bearbeiten" />
<br />
</fieldset>
<br />
<fieldset>
<legend>Belegung löschen</legend>
<input type="submit" name="del" value="L<>schen" />
<br />
</fieldset>
<br />
<fieldset>
<legend>vollständigen Belegungsplan anzeigen</legend>
<input type="submit" name="view" value="Anzeigen" />
<br />
</fieldset>
<form action="<?php echo $ref; ?>" method="post">
<fieldset>
<legend>neue Belegung erstellen</legend>
<input type="submit" name="add" value="Erstellen"/>
<br/>
</fieldset>
<br/>
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="' . $nt1['ID'] . '">' . $nt1['Mieter'] . ' ' . $nt1['Start'] . '</option>';
}
?>
</select>
<br/>
<fieldset>
<legend>Belegung bearbeiten</legend>
<input type="submit" name="edit" value="Bearbeiten"/>
<br/>
</fieldset>
<br/>
<fieldset>
<legend>Belegung löschen</legend>
<input type="submit" name="del" value="L<>schen"/>
<br/>
</fieldset>
<br/>
<fieldset>
<legend>vollständigen Belegungsplan anzeigen</legend>
<input type="submit" name="view" value="Anzeigen"/>
<br/>
</fieldset>
</fieldset>

View File

@@ -1,5 +1,5 @@
<?php
$sql1 = 'SELECT * FROM '.$table.'';
$sql1 = 'SELECT * FROM ' . $table . '';
$result1 = $db->query($sql1);
echo "<label><b>Mieter</b></label>";
@@ -7,14 +7,14 @@ echo "<label><b>Von</b></label>";
echo "<label><b>Bis</b></label>";
echo "<br />";
while ($nt1 = $result1->fetch_assoc()) {
$Start = date("d.m.y",strtotime($nt1['Start']));
$Ende = date("d.m.y",strtotime($nt1['Ende']));
if ('' == $nt1['Mieter']) {
echo "<label>&nbsp;</label>";
} else {
echo "<label>".$nt1['Mieter']."</label>";
}
echo "<label>".$Start."</label>";
echo "<label>".$Ende."</label>";
echo "<br />";
$Start = date("d.m.y", strtotime($nt1['Start']));
$Ende = date("d.m.y", strtotime($nt1['Ende']));
if ('' == $nt1['Mieter']) {
echo "<label>&nbsp;</label>";
} else {
echo "<label>" . $nt1['Mieter'] . "</label>";
}
echo "<label>" . $Start . "</label>";
echo "<label>" . $Ende . "</label>";
echo "<br />";
}

View File

@@ -4,16 +4,16 @@
$table = "Kal_Gaby";
$ref = "index.php?section=kal&t=gaby";
if (isset($_POST['add'])) {
include "inhalte/kal/belegung/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/kal/belegung/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/kal/belegung/del.php";
} elseif (isset($_POST['view'])) {
include "inhalte/kal/belegung/view.php";
} else {
include "inhalte/kal/belegung/standard.php";
}
if (isset($_POST['add'])) {
include "inhalte/kal/belegung/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/kal/belegung/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/kal/belegung/del.php";
} elseif (isset($_POST['view'])) {
include "inhalte/kal/belegung/view.php";
} else {
include "inhalte/kal/belegung/standard.php";
}
?>

View File

@@ -1,16 +1,13 @@
<?php
if (isset($_POST['add'])) {
include "inhalte/kal/saison/add.php";
}
elseif (isset($_POST['edit'])) {
include "inhalte/kal/saison/edit.php";
}
elseif (isset($_POST['del'])) {
include "inhalte/kal/saison/del.php";
}
else {
include "inhalte/kal/saison/standard.php";
}
if (isset($_POST['add'])) {
include "inhalte/kal/saison/add.php";
} elseif (isset($_POST['edit'])) {
include "inhalte/kal/saison/edit.php";
} elseif (isset($_POST['del'])) {
include "inhalte/kal/saison/del.php";
} else {
include "inhalte/kal/saison/standard.php";
}
?>

View File

@@ -2,42 +2,41 @@
<?php
if (!isset($_POST['Speichern'])) {
$sql2 = "SELECT Typ FROM Saison_Typ ORDER BY ID";
$result2 = $db->query($sql2);
?>
$sql2 = "SELECT Typ FROM Saison_Typ ORDER BY ID";
$result2 = $db->query($sql2);
?>
<form action="index.php?section=kal&t=saison" method="post" enctype="multipart/form-data">
<input type="hidden" name="add" value="speichern" />
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Von" />
<br />
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Bis" />
<br />
<label>Saisontyp:</label>
<select name="Typ">
<?php
while ($nt2 = $result2->fetch_assoc()) {
echo "<option>".$nt2['Typ']."</option>";
}
?>
</select>
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=kal&t=saison" method="post" enctype="multipart/form-data">
<input type="hidden" name="add" value="speichern"/>
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Von"/>
<br/>
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Bis"/>
<br/>
<label>Saisontyp:</label>
<select name="Typ">
<?php
while ($nt2 = $result2->fetch_assoc()) {
echo "<option>" . $nt2['Typ'] . "</option>";
}
?>
</select>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$sql1 = 'INSERT INTO Saison (ID, Von, Bis, Typ) VALUES (NULL, "'.$_POST['Von'].'", "'.$_POST['Bis'].'", "'.$_POST['Typ'].'");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: '.$stmt1->error);
}
echo '<a href="index.php?section=kal&t=saison">Zur<75>ck zur <20>bersicht</a>';
<?php
} else {
$sql1 = 'INSERT INTO Saison (ID, Von, Bis, Typ) VALUES (NULL, "' . $_POST['Von'] . '", "' . $_POST['Bis'] . '", "' . $_POST['Typ'] . '");';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgef<65>hrt werden: ' . $stmt1->error);
}
echo '<a href="index.php?section=kal&t=saison">Zur<75>ck zur <20>bersicht</a>';
}
?>

View File

@@ -1,13 +1,13 @@
<?php
$sql2 = 'DELETE FROM Saison WHERE ID = "'.$_POST['Titel'].'"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gelöscht</p>\n";
} else {
echo "Fehler beim Löschen";
}
echo '<a href="index.php?section=kal&t=saison">Zurück zur Übersicht</a>';
$sql2 = 'DELETE FROM Saison WHERE ID = "' . $_POST['Titel'] . '"';
$result2 = $db->query($sql2);
if ($result2) {
echo "<p>Datenbankeintrag gel<EFBFBD>scht</p>\n";
} else {
echo "Fehler beim L<EFBFBD>schen";
}
echo '<a href="index.php?section=kal&t=saison">Zur<EFBFBD>ck zur <EFBFBD>bersicht</a>';
?>

View File

@@ -2,50 +2,49 @@
<?php
if (!isset($_POST['Speichern'])) {
$sql2 = "SELECT Typ FROM Saison_Typ ORDER BY ID";
$result2 = $db->query($sql2);
$sql3 = 'SELECT * FROM Saison WHERE ID = "'.$_POST['Titel'].'"';
$result3 = $db->query($sql3);
$nt3 = $result3->fetch_assoc();
?>
$sql2 = "SELECT Typ FROM Saison_Typ ORDER BY ID";
$result2 = $db->query($sql2);
$sql3 = 'SELECT * FROM Saison WHERE ID = "' . $_POST['Titel'] . '"';
$result3 = $db->query($sql3);
$nt3 = $result3->fetch_assoc();
?>
<form action="index.php?section=kal&t=saison" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern" />
<input type="hidden" name="ID" value="<?php echo $_POST['Titel']; ?>" />
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Von" value="<?php echo $nt3['Von']; ?>" />
<br />
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Bis" value="<?php echo $nt3['Bis']; ?>"/>
<br />
<label>Saisontyp:</label>
<select name="Typ">
<?php
while ($nt2 = $result2->fetch_assoc()) {
if ($nt3['Typ'] == $nt2['Typ']) {
echo "<option selected=\"selected\">".$nt2['Typ']."</option>";
} else {
echo "<option>".$nt2['Typ']."</option>";
}
}
?>
</select>
<br />
<input type="submit" name="Speichern" value="Speichern" />
</form>
<form action="index.php?section=kal&t=saison" method="post" enctype="multipart/form-data">
<input type="hidden" name="edit" value="speichern"/>
<input type="hidden" name="ID" value="<?php echo $_POST['Titel']; ?>"/>
<label>Von (YYYY-MM-TT):</label>
<input type="text" name="Von" value="<?php echo $nt3['Von']; ?>"/>
<br/>
<label>Bis (YYYY-MM-TT):</label>
<input type="text" name="Bis" value="<?php echo $nt3['Bis']; ?>"/>
<br/>
<label>Saisontyp:</label>
<select name="Typ">
<?php
while ($nt2 = $result2->fetch_assoc()) {
if ($nt3['Typ'] == $nt2['Typ']) {
echo "<option selected=\"selected\">" . $nt2['Typ'] . "</option>";
} else {
echo "<option>" . $nt2['Typ'] . "</option>";
}
}
?>
</select>
<br/>
<input type="submit" name="Speichern" value="Speichern"/>
</form>
<?php
}
else {
$sql1 = 'UPDATE Saison SET Von = "'.$_POST['Von'].'", Bis = "'.$_POST['Bis'].'", Typ = "'.$_POST['Typ'].'" WHERE ID = "'.$_POST['ID'].'";';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt1->error);
}
echo '<a href="index.php?section=kal&t=saison">Zurück zur übersicht</a>';
<?php
} else {
$sql1 = 'UPDATE Saison SET Von = "' . $_POST['Von'] . '", Bis = "' . $_POST['Bis'] . '", Typ = "' . $_POST['Typ'] . '" WHERE ID = "' . $_POST['ID'] . '";';
$stmt1 = $db->prepare($sql1);
if (!$stmt1) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgeführt werden: ' . $stmt1->error);
}
echo '<a href="index.php?section=kal&t=saison">Zurück zur übersicht</a>';
}
?>

View File

@@ -5,30 +5,30 @@ $sql1 = 'SELECT * FROM Saison';
$result1 = $db->query($sql1);
?>
<fieldset>
<form action="index.php?section=kal&t=saison" method="post">
<fieldset>
<legend>neuen Zeitraum erstellen</legend>
<input type="submit" name="add" value="Erstellen" />
<br />
</fieldset>
<br />
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="'.$nt1['ID'].'">'.$nt1['Von'].' '.$nt1['Bis'].' '.$nt1['Typ'].'</option>';
}
?>
</select>
<br />
<fieldset>
<legend>Zeitraum bearbeiten</legend>
<input type="submit" name="edit" value="Bearbeiten" />
<br />
</fieldset>
<br />
<fieldset>
<legend>Zeitraum löschen</legend>
<input type="submit" name="del" value="L<>schen" />
<br />
</fieldset>
<form action="index.php?section=kal&t=saison" method="post">
<fieldset>
<legend>neuen Zeitraum erstellen</legend>
<input type="submit" name="add" value="Erstellen"/>
<br/>
</fieldset>
<br/>
<select name="Titel">
<?php
while ($nt1 = $result1->fetch_assoc()) {
echo '<option value="' . $nt1['ID'] . '">' . $nt1['Von'] . ' ' . $nt1['Bis'] . ' ' . $nt1['Typ'] . '</option>';
}
?>
</select>
<br/>
<fieldset>
<legend>Zeitraum bearbeiten</legend>
<input type="submit" name="edit" value="Bearbeiten"/>
<br/>
</fieldset>
<br/>
<fieldset>
<legend>Zeitraum löschen</legend>
<input type="submit" name="del" value="L<>schen"/>
<br/>
</fieldset>
</fieldset>

View File

@@ -1,55 +1,55 @@
<?php
if (!isset($_POST['Speichern'])) {
if ('gaby' == $_GET['t']) {
echo "<h2>Preise Wohnung Gaby</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 1 ";
} elseif ('amelie' == $_GET['t']) {
echo "<h2>Preise Wohnung Amelie</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 2";
} else {
die("Falsche Sektion");
}
echo "<p>Preise bitte mit einem Punkt (.) trennen</p>";
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
?>
<div id="preise">
<form action="index.php?section=preise&t=<?php echo $_GET['t']; ?>" method="post" >
<input type="hidden" name="ID" value="<?php echo $nt1['ID'] ?>" />
<label>Kurbeitrag</label>
<input type="text" name="Kurbeitrag" value="<?php echo $nt1['Kurbeitrag'] ?>" />€
<br />
<label>Nacht3</label>
<input type="text" name="Nacht3" value="<?php echo $nt1['Nacht3'] ?>" />€
<br />
<label>Nacht5</label>
<input type="text" name="Nacht5" value="<?php echo $nt1['Nacht5'] ?>" />€
<br />
<label>Hauptsaison</label>
<input type="text" name="Hauptsaison" value="<?php echo $nt1['Hauptsaison'] ?>" />€
<br />
<label>Nebensaison</label>
<input type="text" name="Nebensaison" value="<?php echo $nt1['Nebensaison'] ?>" />€
<br />
<label>Weihnachten</label>
<input type="text" name="Weihnachten" value="<?php echo $nt1['Weihnachten'] ?>" />€
<br />
<input style="width: auto;" type="submit" name="Speichern" value="Speichern" />
</form>
</div>
<?php
if ('gaby' == $_GET['t']) {
echo "<h2>Preise Wohnung Gaby</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 1 ";
} elseif ('amelie' == $_GET['t']) {
echo "<h2>Preise Wohnung Amelie</h2>";
$sql1 = "SELECT * FROM Preise WHERE ID = 2";
} else {
die("Falsche Sektion");
}
echo "<p>Preise bitte mit einem Punkt (.) trennen</p>";
$result1 = $db->query($sql1);
$nt1 = $result1->fetch_assoc();
?>
<div id="preise">
<form action="index.php?section=preise&t=<?php echo $_GET['t']; ?>" method="post">
<input type="hidden" name="ID" value="<?php echo $nt1['ID'] ?>"/>
<label>Kurbeitrag</label>
<input type="text" name="Kurbeitrag" value="<?php echo $nt1['Kurbeitrag'] ?>"/>€
<br/>
<label>Nacht3</label>
<input type="text" name="Nacht3" value="<?php echo $nt1['Nacht3'] ?>"/>€
<br/>
<label>Nacht5</label>
<input type="text" name="Nacht5" value="<?php echo $nt1['Nacht5'] ?>"/>€
<br/>
<label>Hauptsaison</label>
<input type="text" name="Hauptsaison" value="<?php echo $nt1['Hauptsaison'] ?>"/>€
<br/>
<label>Nebensaison</label>
<input type="text" name="Nebensaison" value="<?php echo $nt1['Nebensaison'] ?>"/>€
<br/>
<label>Weihnachten</label>
<input type="text" name="Weihnachten" value="<?php echo $nt1['Weihnachten'] ?>"/>€
<br/>
<input style="width: auto;" type="submit" name="Speichern" value="Speichern"/>
</form>
</div>
<?php
} else {
$sql2 = 'UPDATE Preise SET Kurbeitrag = "'.$_POST['Kurbeitrag'].'", Nacht3 = "'.$_POST['Nacht3'].'", Nacht5 = "'.$_POST['Nacht5'].'", Hauptsaison = "'.$_POST['Hauptsaison'].'", Nebensaison = "'.$_POST['Nebensaison'].'", Weihnachten = "'.$_POST['Weihnachten'].'" WHERE ID = "'.$_POST['ID'].'";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: '.$db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt->error);
}
echo "Der Eintrag wurde geändert<br />";
echo '<a href="index.php?section=preise">Zurück zur Übersicht</a>';
$sql2 = 'UPDATE Preise SET Kurbeitrag = "' . $_POST['Kurbeitrag'] . '", Nacht3 = "' . $_POST['Nacht3'] . '", Nacht5 = "' . $_POST['Nacht5'] . '", Hauptsaison = "' . $_POST['Hauptsaison'] . '", Nebensaison = "' . $_POST['Nebensaison'] . '", Weihnachten = "' . $_POST['Weihnachten'] . '" WHERE ID = "' . $_POST['ID'] . '";';
$stmt2 = $db->prepare($sql2);
if (!$stmt2) {
die ('Es konnte kein SQL-Query vorbereitet werden: ' . $db->error);
}
if (!$stmt2->execute()) {
die ('Query konnte nicht ausgeführt werden: ' . $stmt->error);
}
echo "Der Eintrag wurde geändert<br />";
echo '<a href="index.php?section=preise">Zurück zur Übersicht</a>';
}
?>