selfservice.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. session_start();
  3. include_once ('tools/htpasswd.php');
  4. include_once ('includes/head.php');
  5. include_once ('includes/nav.php');
  6. $htpasswd = new htpasswd ( $ini ['secure_path'] );
  7. ?>
  8. <div class="container box">
  9. <div class="row">
  10. <div class="col-xs-12">
  11. <h2>Change your password here:</h2>
  12. <?php
  13. $equal = true;
  14. $success = false;
  15. if (isset ( $_POST ['user'] ) && isset ( $_POST ['oldpwd'] ) && isset ( $_POST ['newpwd'] ) && isset ( $_POST ['newpwd2'] )) {
  16. $username = $_POST ['user'];
  17. $old = $_POST ['oldpwd'];
  18. $new = $_POST ['newpwd'];
  19. $new2 = $_POST ['newpwd2'];
  20. if ($new == $new2 && $htpasswd->user_check ( $username, $old )) {
  21. $htpasswd->user_update ( $username, $new );
  22. ?>
  23. <div class="alert alert-info">Password changed successfully.</div>
  24. <?php
  25. } else {
  26. ?>
  27. <div class="alert alert-danger">Could not change password.</div>
  28. <?php
  29. }
  30. }
  31. ?>
  32. <div class="result alert alert-info" style="display: none;"></div>
  33. </div>
  34. </div>
  35. <div class=row>
  36. <div class="col-xs-12 col-md-4">
  37. <form class="navbar-form navbar-left" action="selfservice.php"
  38. method="post">
  39. <div class="form-group">
  40. <input type="text" class="userfield form-control"
  41. placeholder="Username" name="user" <?php if (isset($_GET['user'])) echo "value=".htmlspecialchars($_GET['user']);?>>
  42. </p>
  43. <p>
  44. <input class="passwordfield form-control" type="password"
  45. name="oldpwd" placeholder="Old Password" <?php if (isset($_GET['user'])) echo "autofocus" ?>/>
  46. </p>
  47. <p>
  48. <input class="passwordfield form-control" type="password"
  49. name="newpwd" placeholder="New Password" />
  50. </p>
  51. <p>
  52. <input class="passwordfield form-control" type="password"
  53. name="newpwd2" placeholder="Repeat new Password" />
  54. </p>
  55. <button type="submit" class="btn btn-default">Change</button>
  56. </div>
  57. </form>
  58. </div>
  59. </div>
  60. <div class=row>
  61. <br/><br/>
  62. <div class="col-xs-12 col-md-10 well">
  63. <p>Note: You can't change the admin password here. This is only for user passwords.</p>
  64. </div>
  65. </div>
  66. </div>
  67. <?php
  68. include_once ('includes/footer.php');
  69. ?>