edit_user.php 800 B

123456789101112131415161718192021222324252627
  1. <?php
  2. require 'app.php';
  3. if (isset($_SESSION['user'])) { // Update account info
  4. $username = $_SESSION['user'];
  5. $userid = $_SESSION['userid'];
  6. if (isset($_POST['newPass'])) {
  7. changePassword($userid, $_POST['newPass'], $_POST['repeatNewPass'], $_POST['oldPass']);
  8. } else if (isset($_POST['email'])) {
  9. $mail = $_POST['email'];
  10. if ($mail === $_POST['repeatEmail']) {
  11. new_activation($username, "Email", $mail);
  12. } else {
  13. queue_message(new Message("Addresses do not match.", "danger"));
  14. }
  15. }
  16. // TODO Admin can edit other users' permissions
  17. if (isset($_POST['permissions'])) {
  18. $object = (object) ['property' => 'Here we go'];
  19. }
  20. header("Location: ../account_settings");
  21. } else {
  22. echo "Not logged in.";
  23. }
  24. ?>