Initial commit from online.

This commit is contained in:
2023-12-28 12:13:55 +01:00
commit b65644f3e0
235 changed files with 4060 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<?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";
}
$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>
<?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";
}
}

View File

@@ -0,0 +1,17 @@
<h2>Fotos der Bildergalerie</h2>
<?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

@@ -0,0 +1,59 @@
<h3>Neues Bild hinzufü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>
<?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);
}
if (!$stmt1->execute()) {
die ('Query konnte nicht ausgeführt werden: '.$stmt1->error);
}
$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>';
}
?>

View File

@@ -0,0 +1,39 @@
<?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>';
}
?>

View File

@@ -0,0 +1,38 @@
<h3>Bildüberschrift ändern</h3>
<?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'];
?>
<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>';
}
?>

View File

@@ -0,0 +1,32 @@
<?php
$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>
</fieldset>

View File

@@ -0,0 +1,2 @@
<p>In diesem Bereich können die Fotos für die einzelnen Bildergalerien hochgeladen werden.</p>
<p>Dafür muss eine Sektion im linken Bereich ausgewählt werden.</p>

View File

@@ -0,0 +1,68 @@
<?php
$path = "../img/haus/wohn/";
$ref = "index.php?section=fotos&t=".$_GET['t'];
if (!isset($_GET['action'])) {
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";
}
}
?>