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

21
admin/inhalte/gb/del.php Normal file
View File

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

46
admin/inhalte/gb/edit.php Normal file
View File

@@ -0,0 +1,46 @@
<h3>Gästebucheintrag ä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();
?>
<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>';
}
?>

67
admin/inhalte/gb/new.php Normal file
View File

@@ -0,0 +1,67 @@
<h3>neuen Gä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>
<?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);
}
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/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>';
}
?>