Backend for AJAX calls
authorJoey Schulze <joey@infodrom.org>
Sun, 7 Apr 2013 15:26:24 +0000 (15:26 +0000)
committerJoey Schulze <joey@infodrom.org>
Sun, 7 Apr 2013 15:26:24 +0000 (15:26 +0000)
src/InfoCon/stempel/index.wml

index 3ec1a59..24bdee2 100644 (file)
@@ -7,6 +7,17 @@
 
   pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
 
+  if ($_POST['func'] == 'save') {
+    $sql = sprintf("UPDATE stempel SET task = '%s' WHERE oid = %d",
+                  pg_escape_string($_POST['task']),
+                  $_POST['oid']);
+    pg_exec($sql);
+
+    header('Content-type: application/json; charset="UTF-8"');
+    echo json_encode(true);
+    exit;
+  }
+
   if (isset($_GET['month']))
     $month = $_GET['month'];
   else