Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Active Directory Phonebook
23-12-2008, 02:31 AM
Post: #11
 
Hi

I am pretty new to PHP and LDAP, and am curently using AD phone book to look up user details in our company, my question is how hard is it to have the php/code search multiple OU's with in the AD, and how would I go about this.

thanks

Stuart
Send this user an email Find all posts by this user
Quote this message in a reply
03-03-2009, 07:38 PM
Post: #12
OU searching
You will need to check the ldap.config.php file this is where you set the limit... the higher the level that you have it search on the AD tree the more results you will get... so for the example... use the full domain such as site.domain and do not add any OU information.

Code:
<?php

//the host for the ad domain, company.local, etc.
$ldap_host = "site.domain"; // enter your domain in domain.extension format: e.g. abc.com
    
//the ou the you will be pulling results from, it reads backwards - you may have to us CN= or OU=, have seen both work
$base_dn = [color=blue]"DC=site, DC=domain"; [/color] //enter the primary OU here, then the first part of the domain name, then the second:  e.g:  "OU=users,  DC=abc, DC=com"

//the username for the domain, most users have read rights to ad
$ldap_user  = "user@site.domain";  

//the password for that username    
$ldap_pass = "thispassword";

?>
Send this user an email Find all posts by this user
Quote this message in a reply
04-03-2009, 09:12 PM
Post: #13
 
Gpetit asked whether it would be possible to export the results to excel.

This is something I can do with data from an SQL database no problems, but not sure how you would read the info from the LDAP in to excel.

I will look in to it though.

I did think of one point instead of it referencing AD on the fly instead having it pull the info from LDAP in to a mySQL db then have the phonebook run from there.

Have the database updated once an hour, therefore reducing load on the LDAP server and adding possibilities for the phone book as a whole.

- Techmonkey
================
Enterprise Business IT Support | SME IT Support | Home Support Available
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
18-03-2009, 09:57 PM
Post: #14
AD phone book.
Ok I am still new to PHP and coding. How would one take the great work that has already been done and move it to MySQL?
Send this user an email Find all posts by this user
Quote this message in a reply
23-03-2009, 04:38 PM
Post: #15
 
Good question.

What you would need to do is set up first a database with all the relevant fields from the Active Directory that you want to store.

You would then want to use the script above to pull the info from Active Directory and populate/update records within the mySQL database, you could then set it up as a cron job or scheduled task to run once an hour.

- Techmonkey
================
Enterprise Business IT Support | SME IT Support | Home Support Available
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
18-06-2009, 05:06 PM
Post: #16
 
As this is my 1st post .. I'd like to say
Hi all ..
:lol

I'm having a problem with the Phonebook..
i get this error msg.

Warning: ldap_search() [function.ldap-search]: Search: No such object in C:\wamp\www\phonebook\index.php on line 232
>>Unable to search or no details entered!<<

the code is

Code:
231      //search ad ldap
232     $read = ldap_search($connect, $base_dn, $filter, $get_this)
233        or exit(">>Unable to search or no details entered!<<");

what have i done ?? :blush
im running this on wamp woth ldap
and im trying to access 2008 AD


thanks..
Send this user an email Find all posts by this user
Quote this message in a reply
19-06-2009, 11:43 AM
Post: #17
 
Hi Cools, :welcome to Techmonkeys Smile

I have not tested this code with Server 2008, it was written for server 2000 and no written very well at that.

See if you can find any info on making php and ldap work with server 2008 as it may have different type of connection

- Techmonkey
================
Enterprise Business IT Support | SME IT Support | Home Support Available
Send this user an email Visit this user's website Find all posts by this user
Quote this message in a reply
09-09-2009, 09:16 AM
Post: #18
 
Hi,

I have a question, i hope you can help me Wink
Im new to php and LDAP.

The Phonebook is working very well, i have changed some things, but its still running *g*

Now my question:

The users i want to search are on two different Groups.
my config is:
$base_dn = "OU=Benutzer, OU=Group, DC=test, DC=test1, DC=local";

the other users are in "OU=Benutzer, OU=IT, DC=test, DC=test1, DC=local"

how can i search in both groups?
i hope its not to difficult Wink
Send this user an email Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: