Permalink
Browse files

added backend for publish saving

  • Loading branch information...
DerWaldschrat committed Mar 23, 2013
1 parent 60e3d5f commit cb16df9e89ea3254226e02e21749614e89dcb273
Showing with 24 additions and 0 deletions.
  1. +24 −0 User/publishSettings.php
View
@@ -0,0 +1,24 @@
+<?php
+define("__EXEC", true);
+define("IN", "../");
+define("PHP_EX", ".php");
+
+require IN . "coreconfig" . PHP_EX;
+require IN . "mapper" . PHP_EX;
+require IN . "validator" . PHP_EX;
+
+if (isLoggedin()) {
+ post(function () {
+ $body = bodyAsJSON();
+ if (hasAllSetIsset($body, array("publish_ok", "publish_problems"))) {
+ $db = db();
+ $userid = userField("userid");
+ $st = $db->prepare("UPDATE " . USER_DATA . " SET publish_ok = ?, publish_problems = ? WHERE userid = " . $userid);
+ $st->bind_param("is", $body->publish_ok, $body->publish_problems);
+ $st->execute();
+ } else {
+ h404();
+ }
+ }, true);
+}
+?>

0 comments on commit cb16df9

Please sign in to comment.