2004-10-19 20:58:50 +02:00
|
|
|
<?php
|
2003-09-03 18:02:43 +02:00
|
|
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2006-11-26 19:24:53 +01:00
|
|
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
2008-04-09 20:13:45 +02:00
|
|
|
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2003-09-03 18:02:43 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-09-03 18:02:43 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-09-03 18:02:43 +02:00
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2006-11-26 19:24:53 +01:00
|
|
|
/**
|
2010-03-01 09:55:43 +01:00
|
|
|
* \file htdocs/adherents/htpasswd.php
|
|
|
|
|
* \ingroup member
|
2019-09-20 09:44:49 +02:00
|
|
|
* \brief Export page htpasswd of the membership file
|
2010-03-01 09:55:43 +01:00
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
2012-02-13 01:43:35 +01:00
|
|
|
|
2021-03-29 15:24:47 +02:00
|
|
|
$status = GETPOST('status', 'int');
|
|
|
|
|
$cotis = GETPOST('cotis', 'int');
|
|
|
|
|
|
|
|
|
|
$sortfield = GETPOST('sortfield', 'alphanohtml');
|
|
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09');
|
|
|
|
|
|
2012-02-13 01:43:35 +01:00
|
|
|
// Security check
|
2021-03-29 15:24:47 +02:00
|
|
|
if (empty($conf->adherent->enabled)) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2021-10-22 22:15:59 +02:00
|
|
|
if (empty($user->rights->adherent->export)) {
|
2021-03-01 00:19:52 +01:00
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2012-02-13 01:43:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
2003-09-03 18:02:43 +02:00
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$now = dol_now();
|
2012-04-30 15:01:25 +02:00
|
|
|
|
2021-03-01 00:19:52 +01:00
|
|
|
if (empty($sortorder)) {
|
|
|
|
|
$sortorder = "ASC";
|
|
|
|
|
}
|
|
|
|
|
if (empty($sortfield)) {
|
|
|
|
|
$sortfield = "d.login";
|
|
|
|
|
}
|
2006-11-26 19:24:53 +01:00
|
|
|
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql = "SELECT d.login, d.pass, d.datefin";
|
2004-02-01 01:42:23 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
2021-03-29 15:24:47 +02:00
|
|
|
$sql .= " WHERE d.statut = ".((int) $status);
|
2020-05-21 09:12:18 +02:00
|
|
|
if ($cotis == 1) {
|
2012-04-30 15:01:25 +02:00
|
|
|
$sql .= " AND datefin > '".$db->idate($now)."'";
|
2003-09-03 18:02:43 +02:00
|
|
|
}
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= $db->order($sortfield, $sortorder);
|
2006-11-26 19:24:53 +01:00
|
|
|
//$sql.=$db->plimit($conf->liste_limit, $offset);
|
2003-09-03 18:02:43 +02:00
|
|
|
|
2006-11-26 19:24:53 +01:00
|
|
|
$resql = $db->query($sql);
|
2020-05-21 09:12:18 +02:00
|
|
|
if ($resql) {
|
2006-11-26 19:24:53 +01:00
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
2021-03-29 15:24:47 +02:00
|
|
|
$param = '';
|
2019-01-27 11:55:16 +01:00
|
|
|
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
|
2006-11-26 19:24:53 +01:00
|
|
|
|
|
|
|
|
print "<hr>\n";
|
2020-05-21 09:12:18 +02:00
|
|
|
while ($i < $num) {
|
2006-11-26 19:24:53 +01:00
|
|
|
$objp = $db->fetch_object($result);
|
2020-04-10 10:59:32 +02:00
|
|
|
$htpass = crypt($objp->pass, makesalt());
|
2006-11-26 19:24:53 +01:00
|
|
|
print $objp->login.":".$htpass."<br>\n";
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
print "<hr>\n";
|
2020-05-21 00:47:16 +02:00
|
|
|
} else {
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2003-09-03 18:02:43 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-28 14:29:28 +02:00
|
|
|
// End of page
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-02-13 01:43:35 +01:00
|
|
|
$db->close();
|