updatePermissions.php 620 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. require("app.php");
  3. if (!hasPermission("edit.User")) {
  4. die("Not enough permissions.");
  5. }
  6. $uid = $_GET['uid'];
  7. $custom = $_POST['custom'];
  8. $level = $_POST['level'];
  9. $level = intval($level);
  10. $permissions = new StdClass();
  11. $permissions->permission_level = $level;
  12. $permissions->custom_permissions = json_decode($custom);
  13. $permissionString = json_encode($permissions);
  14. if ($conn->query("UPDATE Users SET Permissions='$permissionString' WHERE UID='$uid'")) {
  15. echo "Successfully updated permissions.";
  16. } else {
  17. echo "Error updating database: " . $conn->lastErrorMsg();
  18. }
  19. ?>