2
0

cms.user.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. if(core::ifGet("add")) {
  3. $id_form = '<input type="hidden" name="id" value="add">';
  4. $submit = "Ajouter un profil";
  5. $titre = "Ajouter un profil";
  6. } else {
  7. $databaseUser = new user();
  8. if(core::ifGet("id")){
  9. $user = $databaseUser->getUserById(core::getGet("id"));
  10. $submit = "Modifier ce profil";
  11. $titre = "Fiche de " . $user["prenom"] . " " . $user["nom"];
  12. } else {
  13. $user = $databaseUser->getUserById(session::getId());
  14. $submit = "Modifier votre profil";
  15. $titre = "Votre fiche de profil";
  16. }
  17. $id_form = '<input type="hidden" name="id" value="' . $user["id"] . '">';
  18. }
  19. ?>
  20. <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light row">
  21. <div class="col-11">
  22. <h2 class="bd-title" id="content">
  23. <span><?php echo $titre ?></span>
  24. </h2>
  25. <?php if(isset($user["id"]) AND session::getId() != $user["id"]){ ?>
  26. <div style="float:right; margin: -30px;">
  27. <a href="/submit.php?from=user-delete&id=<?php echo $user["id"] ?>" onclick="return confirm('Voulez-vous supprimer le compte de <?php echo $user["prenom"] . " " . $user["nom"]; ?> ?')" style="position: absolute; right: 0; margin: 0 40px 0 0;"><button type="submit" class="btn btn-outline-danger btn-sm"><span data-feather="trash-2"></span> Supprimer</button></a>
  28. </div>
  29. <?php } ?>
  30. <?php if(isset($user["last_connect"])){ echo '<h6>Dernière connexion : ' . $user["last_connect"] .'</h6>'; } ?>
  31. </div>
  32. </header>
  33. <br />
  34. <form method="post" action="/submit.php" oninput='password2.setCustomValidity(password2.value != password.value ? "Les mots de passe ne sont pas identiques" : "")'>
  35. <input type="hidden" name="from" value="user">
  36. <?php
  37. echo $id_form;
  38. ?>
  39. <div class="form-group">
  40. <label>Type de compte</label>
  41. <select name="id_type" class="form-select">
  42. <option value="2"<?php if(isset($user["id_type"]) AND $user["id_type"] == 2){ echo " selected"; } ?>>Contrôleur QRCode (émargement)</option>
  43. <option value="3"<?php if(isset($user["id_type"]) AND $user["id_type"] == 3){ echo " selected"; } ?>>Assitance sociale</option>
  44. <option value="1"<?php if(isset($user["id_type"]) AND $user["id_type"] == 1){ echo " selected"; } ?>>Administrateur</option>
  45. </select>
  46. </div>
  47. <br />
  48. <div class="form-group">
  49. <label>Prénom</label>
  50. <input type="text" class="form-control" value="<?php
  51. if (isset($user["prenom"])) {
  52. echo $user["prenom"];
  53. }
  54. ?>" name="prenom" placeholder="" required>
  55. </div>
  56. <br />
  57. <div class="form-group">
  58. <label>nom</label>
  59. <input type="text" class="form-control" value="<?php
  60. if (isset($user["nom"])) {
  61. echo $user["nom"];
  62. }
  63. ?>" name="nom" placeholder="" required>
  64. </div>
  65. <br />
  66. <div class="form-group">
  67. <label>Email</label>
  68. <input type="email" class="form-control" value="<?php
  69. if (isset($user["email"])) {
  70. echo $user["email"];
  71. }
  72. ?>" name="email" placeholder="" required>
  73. </div>
  74. <br />
  75. <div class="form-group">
  76. <label>Mot de passe</label>
  77. <input type="password" class="form-control" minlength="8" maxlength="25" value="" name="password" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
  78. </div>
  79. <br />
  80. <div class="form-group">
  81. <label>Confirmation du mot de passe</label>
  82. <input type="password" class="form-control" value="" name="password2" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
  83. </div>
  84. <br />
  85. <div class="form-group">
  86. <label>Etat du compte</label>
  87. <select name="actif" class="form-select">
  88. <option value="0"<?php if(isset($user["actif"]) AND $user["actif"] == 0){ echo " selected"; } ?>>Compte désactivé</option>
  89. <option value="1"<?php if(isset($user["actif"]) AND $user["actif"] == 1){ echo " selected"; } ?>>Compte activé</option>
  90. </select>
  91. </div>
  92. <br />
  93. <input class="btn btn-primary btn-lg" style="width: 100%" type="submit" value="<?php echo $submit ?>">
  94. </form>