htpasswd.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/adherents/htpasswd.php
  21. * \ingroup member
  22. * \brief Page d'export htpasswd du fichier des adherents
  23. * \author Rodolphe Quiedeville
  24. */
  25. require("../main.inc.php");
  26. require_once(DOL_DOCUMENT_ROOT.'/lib/security.lib.php');
  27. llxHeader();
  28. if ($sortorder == "") { $sortorder="ASC"; }
  29. if ($sortfield == "") { $sortfield="d.login"; }
  30. if (! isset($statut))
  31. {
  32. $statut = 1 ;
  33. }
  34. if (! isset($cotis))
  35. {
  36. // par defaut les adherents doivent etre a jour de cotisation
  37. $cotis=1;
  38. }
  39. $sql = "SELECT d.login, d.pass, d.datefin";
  40. $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
  41. $sql .= " WHERE d.statut = $statut ";
  42. if ($cotis==1)
  43. {
  44. $sql .= " AND datefin > ".$db->idate(mktime());
  45. }
  46. $sql.= $db->order($sortfield,$sortorder);
  47. //$sql.=$db->plimit($conf->liste_limit, $offset);
  48. $resql = $db->query($sql);
  49. if ($resql)
  50. {
  51. $num = $db->num_rows($resql);
  52. $i = 0;
  53. print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',0);
  54. print "<hr>\n";
  55. while ($i < $num)
  56. {
  57. $objp = $db->fetch_object($result);
  58. $htpass=crypt($objp->pass,makesalt());
  59. print $objp->login.":".$htpass."<br>\n";
  60. $i++;
  61. }
  62. print "<hr>\n";
  63. }
  64. else
  65. {
  66. dol_print_error($db);
  67. }
  68. $db->close();
  69. llxFooter();
  70. ?>