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

@@ -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>