cms.user.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. if (core::ifPost("from") AND core::getPost("from") == "user") {
  3. if(core::getPost("id") == "add"){
  4. user::add_user(core::getPost());
  5. historique::recRef("/user-".user::lastUser().".html");
  6. historique::add(array(
  7. "idType" => historique::getIdRef("ACTION"),
  8. "idUser" => session::getId(),
  9. "idPage" => historique::getIdRef("/user-".user::lastUser().".html"),
  10. "log" => "Création du compte de " . user::lastUser()
  11. ));
  12. alert::recSuccess("Création du compte de ". user::getNameById(user::lastUser()));
  13. header("Location: /user-" . user::lastUser() . ".html");
  14. exit();
  15. } else {
  16. user::maj_user(core::getPost());
  17. historique::recRef("/user-".core::getPost("id").".html");
  18. historique::add(array(
  19. "idType" => historique::getIdRef("ACTION"),
  20. "idUser" => session::getId(),
  21. "idPage" => historique::getIdRef("/user-".core::getPost("id").".html"),
  22. "log" => "Modification du compte de " . user::getNameById(core::getPost("id"))
  23. ));
  24. if(core::getPost("id") == session::getId()){
  25. alert::recSuccess("Modification de votre compte");
  26. header("Location: /user.html");
  27. } else {
  28. alert::recSuccess("Modification du compte de ". user::getNameById(core::getPost("id")));
  29. header("Location: /user-" . core::getPost("id") . ".html");
  30. }
  31. exit();
  32. }
  33. } else {
  34. header('HTTP/1.0 401 Unauthorized');
  35. exit();
  36. }