summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorus_arch2017-01-03 12:05:11 +0100
committerhorus_arch2017-01-03 12:05:11 +0100
commite39c7636074f88ee29d05ec87fe718a8fe65d9a7 (patch)
tree6b57e72853130f916a573960fa5d683cc0db7f7e
parent32f27ce9e530fd23c40c4163180fdc4c43dfcff4 (diff)
downloadgospeladlershof.de-e39c7636074f88ee29d05ec87fe718a8fe65d9a7.tar.gz
Man kann Proben jetzt auch direkt löschen.
-rw-r--r--intern.gospeladlershof.de/code/proben/delete.php25
-rw-r--r--intern.gospeladlershof.de/index.php2
2 files changed, 27 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/proben/delete.php b/intern.gospeladlershof.de/code/proben/delete.php
new file mode 100644
index 0000000..9c59f1b
--- /dev/null
+++ b/intern.gospeladlershof.de/code/proben/delete.php
@@ -0,0 +1,25 @@
+<?php
+
+require_once __DIR__ . '/../db.php';
+require_once __DIR__ . '/../session.php';
+
+$db = get_db();
+
+$id = $_REQUEST["proben_id"];
+
+try {
+ $stmt = $db->prepare("DELETE FROM proben WHERE id = :proben_id;");
+
+ $stmt->bindValue(":proben_id", $id);
+
+ $stmt->execute();
+} catch ( Exception $e ) {
+ $_SESSION["error"] = $e->getMessage();
+ error_log($e->getMessage());
+}
+
+if ( empty($_SESSION) || is_null($_SESSON["error"]) ) {
+ $_SESSION["success"] = "Probe gelöscht!";
+}
+header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect");
+header("Location: /");
diff --git a/intern.gospeladlershof.de/index.php b/intern.gospeladlershof.de/index.php
index d7e461b..2ec7ccb 100644
--- a/intern.gospeladlershof.de/index.php
+++ b/intern.gospeladlershof.de/index.php
@@ -116,6 +116,7 @@ if ( isset($_SESSION["error"]) && ! is_null($_SESSION["error"]) ) {
<th>Termin</th>
<th>Uhrzeit</th>
<th>Aktualisieren</th>
+ <th>Löschen</th>
</tr>
</thead>
<tbody>
@@ -133,6 +134,7 @@ if ( isset($_SESSION["error"]) && ! is_null($_SESSION["error"]) ) {
<td><?php echo htmlentities($item["termin"]); ?></td>
<td><?php echo htmlentities($item["uhrzeit"]); ?></td>
<td><a href="update_proben.php?id=<?php echo htmlentities($item["id"]);?>" title="Den Eintrag ändern"><span class="glyphicon glyphicon-pencil"></span></a></td>
+ <td><a href="code/proben/delete.php?id=<?php echo htmlentities($item["id"]);?>" title="Den Termin löschen"><span style="color: red;" class="glyphicon glyphicon-remove"></span></a></td>
</tr>
<?php
}