Archive for the ‘LDAP’ Category

Create a Staff Directory webpage using PHP and LDAP

Wednesday, July 25th, 2007

Here’s the scenario:

We use LDAP to store the information on staff such as names, usernames, email addresses, telephone numbers, photos, passwords etc.

We want a webpage the displays up to date details off all the staff in our organisation. We would like to dynamically extract the information about the staff from our existing LDAP database and present it as a webpage on our intranet.

1. Download the scripts I’ve written here and extract them to a directory on your Intranet server or somewhere suitable.

EG. http://intranet/StaffDirectory/

2. Configure the script.

Enter you LDAP hostname and distinguished name.
Users have previously created using the inetOrgPerson LDAP object Class. This gives us attributes to use such as displayName, mail, telephoneNumber and jpegPhoto.

We enter the LDAP atrributes we wish to extract into the $params array below.

$ip = “your_ldap_hostname”;
$dn = “dc=example,dc=org”;
$params = array( “displayName”, “mail”, “telephoneNumber”, “jpegPhoto”);

3. Browse to http://intranet/StaffDirectory/index.php to view all the the details of you staff members.