diff options
| author | Horus3 | 2016-12-02 19:48:41 +0100 |
|---|---|---|
| committer | Horus3 | 2016-12-02 19:48:41 +0100 |
| commit | cbc20d51ce2db57837d47faf320396c75281c91f (patch) | |
| tree | ad1403f0814f8b6f1eafcc31ef31c841124d070e /intern.gospeladlershof.de/code | |
| parent | 0e26026355120d1fa7478a5d5bf8b7bd407a2696 (diff) | |
| download | gospeladlershof.de-cbc20d51ce2db57837d47faf320396c75281c91f.tar.gz | |
Fügt jetzt auch das Backend für das Editieren der Chorbeschreibungen hinzu.
Diffstat (limited to 'intern.gospeladlershof.de/code')
| -rw-r--r-- | intern.gospeladlershof.de/code/chor/insert.php | 24 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/code/chor/update.php | 27 |
2 files changed, 51 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/chor/insert.php b/intern.gospeladlershof.de/code/chor/insert.php new file mode 100644 index 0000000..f1ec3d0 --- /dev/null +++ b/intern.gospeladlershof.de/code/chor/insert.php @@ -0,0 +1,24 @@ +<?php + +require_once __DIR__ . '/../db.php'; +require_once __DIR__ . '/../session.php'; + +$db = get_db(); + +$nachricht = $_REQUEST["termin"]; + +try { + $stmt = $db->prepare("INSERT INTO chor (id, nachricht) VALUES(NULL, :nachricht);"); + $stmt->bindValue(":nachricht", $nachricht); + $stmt->execute(); + +} catch ( Exception $e ) { + $_SESSION["error"] = $e->getMessage(); + error_log($e->getMessage()); +} + +if ( empty($_SESSION) || is_null($_SESSON["error"]) ) { + $_SESSION["success"] = "Erfolgreich eingetragen!"; +} +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: /"); diff --git a/intern.gospeladlershof.de/code/chor/update.php b/intern.gospeladlershof.de/code/chor/update.php new file mode 100644 index 0000000..a781835 --- /dev/null +++ b/intern.gospeladlershof.de/code/chor/update.php @@ -0,0 +1,27 @@ +<?php + +require_once __DIR__ . '/../db.php'; +require_once __DIR__ . '/../session.php'; + +$db = get_db(); + +$id = $_REQUEST["id"]; +$nachricht = $_REQUEST["termin"]; + +try { + $stmt = $db->prepare("UPDATE chor set nachricht =:nachricht WHERE id=:id;"); + + $stmt->bindValue(":id", $id); + $stmt->bindValue(":nachricht", $nachricht); + $stmt->execute(); + +} catch ( Exception $e ) { + $_SESSION["error"] = $e->getMessage(); + error_log($e->getMessage()); +} + +if ( empty($_SESSION) || is_null($_SESSON["error"]) ) { + $_SESSION["success"] = "Erfolgreich aktualisiert!"; +} +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: /"); |
