summaryrefslogtreecommitdiff
path: root/intern.gospeladlershof.de/code/proben
diff options
context:
space:
mode:
authorHorus32016-09-28 14:43:44 +0200
committerHorus32016-09-28 14:43:44 +0200
commit6decb91aa4cc27c83c866d1b128dc719aeb1c986 (patch)
tree477a08f5296bbf4ab75b53893b25f900b6e0ad8f /intern.gospeladlershof.de/code/proben
parent4c39424720d6be708896f42b73a93df3c2637a10 (diff)
parent006da29841a225675fc7dc4981b69336409737e1 (diff)
downloadgospeladlershof.de-6decb91aa4cc27c83c866d1b128dc719aeb1c986.tar.gz
Merge branch 'master' of git.iamfabulous.de:gospeladlershof.de
Diffstat (limited to 'intern.gospeladlershof.de/code/proben')
-rw-r--r--intern.gospeladlershof.de/code/proben/insert.php29
-rw-r--r--intern.gospeladlershof.de/code/proben/update.php33
2 files changed, 62 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/proben/insert.php b/intern.gospeladlershof.de/code/proben/insert.php
new file mode 100644
index 0000000..df0e257
--- /dev/null
+++ b/intern.gospeladlershof.de/code/proben/insert.php
@@ -0,0 +1,29 @@
+<?php
+
+require_once __DIR__ . '/../db.php';
+require_once __DIR__ . '/../session.php';
+
+$db = get_db();
+
+$termin = $_REQUEST["termin"];
+$uhrzeit = $_REQUEST["uhrzeit"];
+#$bemerkung = $_REQUEST["bemerkung"];
+
+try {
+ $stmt = $db->prepare("INSERT INTO proben (id, termin, uhrzeit, bemerkung) VALUES(NULL, :termin, :uhrzeit, :bemerkung);");
+
+ $stmt->bindValue(":termin", $termin);
+ $stmt->bindValue(":uhrzeit", $uhrzeit);
+ $stmt->bindValue(":bemerkung", null);
+
+ $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/proben/update.php b/intern.gospeladlershof.de/code/proben/update.php
new file mode 100644
index 0000000..e8694d8
--- /dev/null
+++ b/intern.gospeladlershof.de/code/proben/update.php
@@ -0,0 +1,33 @@
+<?php
+
+require_once __DIR__ . '/../db.php';
+require_once __DIR__ . '/../session.php';
+
+$db = get_db();
+
+$id = $_REQUEST["id"];
+$termin = $_REQUEST["termin"];
+$uhrzeit = $_REQUEST["uhrzeit"];
+#$bemerkung = $_REQUEST["bemerkung"];
+
+try {
+ $stmt = $db->prepare("UPDATE proben set termin=:termin, uhrzeit=:uhrzeit, bemerkung=:bemerkung WHERE id=:id;");
+
+ $stmt->bindValue(":id", $id);
+ $stmt->bindValue(":termin", $termin);
+ $stmt->bindValue(":uhrzeit", $uhrzeit);
+ #$stmt->bindValue(":bemerkung", $bemerkung);
+ $stmt->bindValue(":bemerkung", null);
+
+ $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: /");