cms.user.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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"
  11. ));
  12. header("Location: /user-" . user::lastUser() . ".html");
  13. exit();
  14. } else {
  15. user::maj_user(core::getPost());
  16. historique::recRef("/user-".core::getPost("id").".html");
  17. historique::add(array(
  18. "idType" => historique::getIdRef("ACTION"),
  19. "idUser" => session::getId(),
  20. "idPage" => historique::getIdRef("/user-".core::getPost("id").".html"),
  21. "log" => "Modification du compte"
  22. ));
  23. if(core::getPost("id") == session::getId()){
  24. header("Location: /user.html");
  25. } else {
  26. header("Location: /user-" . core::getPost("id") . ".html");
  27. }
  28. exit();
  29. }
  30. } else {
  31. header('HTTP/1.0 401 Unauthorized');
  32. exit();
  33. }