LDAPAccountManager/lam/lib/listusers.php

81 lines
2.8 KiB
PHP
Raw Normal View History

2003-03-09 13:18:14 +00:00
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 Leonhard Walchsh<EFBFBD>usl
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 2 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 detaexils.
2003-03-09 13:18:14 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include_once ('../config/config.php');
include_once("ldap.php");
// class representing local user entry with attributes of ldap user entry
include_once("userentry.php");
2003-03-09 13:18:14 +00:00
2003-04-02 21:42:51 +00:00
echo "<head>";
2003-03-09 13:18:14 +00:00
2003-04-02 21:42:51 +00:00
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\" />";
echo "<script src=\"./functions.js\" type=\"text/javascript\" language=\"javascript\"></script>";
echo "</head>";
echo "<body bgcolor=\"#F5F5F5\">";
// config object should be in session!!!
$config = new Config();
$ldap = new Ldap($config);
// username/password should also be in session!!!
$username = "cn=admin,o=test,c=de";
$passwd = "secret";
$result = $ldap->connect ($username, $passwd);
$user_dn_list = $ldap->getUsers ($config->get_UserSuffix());
echo "<table width=\"100%\">\n";
2003-03-09 13:18:14 +00:00
// print attribute headers
echo "<tr>";
2003-04-02 21:42:51 +00:00
echo "<th class=\"userlist\"></th>";
echo "<th class=\"userlist\">Vorname</th>";
echo "<th class=\"userlist\">Nachname</th>";
echo "<th class=\"userlist\">Uid</th>";
echo "<th class=\"userlist\">Home Verzeichnis</th>";
echo "</tr>";
2003-04-02 21:42:51 +00:00
$row_number = 0;
foreach ($user_dn_list as $user_dn) {
2003-04-02 21:42:51 +00:00
echo "<tr onmouseover=\"setPointer(this, " . $row_number . ", 'over', '#DDDDDD', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, " . $row_number . ", 'out', '#DDDDDD', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, " . $row_number . ", 'click', '#DDDDDD', '#CCFFCC', '#FFCC99');\">\n";
$row_number++;
$userentry = new UserEntry();
$userentry = $ldap->getEntry ($user_dn, $userentry);
$ldap->getEntry ($user_dn, $userentry);
2003-04-02 21:42:51 +00:00
echo ("<td class=\"userlist\">" . "<input type=\"checkbox\" name=\"..\"" . "</td>");
echo ("<td class=\"userlist\">" . current ($userentry->getGivenName()) . "</td>");
echo ("<td class=\"userlist\">" . current ($userentry->getSn()) . "</td>");
echo ("<td class=\"userlist\">" . current ($userentry->getUid()) . "</td>");
echo ("<td class=\"userlist\">" . current ($userentry->gethomeDirectory()) . "</td>");
2003-03-09 13:18:14 +00:00
echo "</tr>\n";
}
echo "</table>";
2003-04-02 21:42:51 +00:00
echo "</body>";
2003-03-09 13:18:14 +00:00
$ldap->close();
2003-03-09 13:18:14 +00:00
?>