dolibarr/htdocs/adherents/htpasswd.php

84 lines
2.2 KiB
PHP
Raw Normal View History

<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (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/>.
*/
/**
* \file htdocs/adherents/htpasswd.php
* \ingroup member
2019-09-20 09:44:49 +02:00
* \brief Export page htpasswd of the membership file
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// Security check
if (!$user->rights->adherent->export) accessforbidden();
/*
* View
*/
llxHeader();
$now = dol_now();
2012-04-30 15:01:25 +02:00
if (empty($sortorder)) { $sortorder = "ASC"; }
if (empty($sortfield)) { $sortfield = "d.login"; }
2020-05-21 09:12:18 +02:00
if (!isset($statut)) {
2019-11-02 11:36:48 +01:00
$statut = 1;
}
2020-05-21 09:12:18 +02:00
if (!isset($cotis)) {
2019-05-23 14:25:16 +02:00
// by default, members must be up to date of subscription
$cotis = 1;
}
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
2019-11-02 11:36:48 +01:00
$sql .= " WHERE d.statut = ".$statut;
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)."'";
}
$sql .= $db->order($sortfield, $sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset);
$resql = $db->query($sql);
2020-05-21 09:12:18 +02:00
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
print "<hr>\n";
2020-05-21 09:12:18 +02:00
while ($i < $num) {
$objp = $db->fetch_object($result);
$htpass = crypt($objp->pass, makesalt());
print $objp->login.":".$htpass."<br>\n";
$i++;
}
print "<hr>\n";
2020-05-21 00:47:16 +02:00
} else {
dol_print_error($db);
}
2018-07-28 14:29:28 +02:00
// End of page
llxFooter();
$db->close();