Date: Fri, 14 Jan 2005 15:32:15 -0600 From: Redmond Militante <r-militante@xxxxxxxxxxxxxxxx> To: php-general@xxxxxxxxxxxxx Subject: Re: Re: get user attributes php/ldap/win2k active directory Reply-To: Redmond Militante <r-militante@xxxxxxxxxxxxxxxx> In-Reply-To: <20031023200258.76971.qmail@xxxxxxxxxxxx> User-Agent: Mutt/1.4.2.1i X-Sender: redmond@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X-URL: http://darkpossum.medill.northwestern.edu/gnupg.php X-PGP-Fingerprint: 2AA2 E78E A6FC 9144 3534 39A2 EE0F 8D26 5FDF 481D hi this solution, along with ldap browser, worked for me. however, now i want to change my search string and i'm having problems... i'm using $sr = ldap_search($ldapconn,"CN=Users,DC=companyname,DC=com", 'CN='.$username); to search through the ldap directory for the username. this works fine. but if i try $sr = ldap_search($ldapconn,"CN=staff,CN=Users,DC=companyname,DC=com", 'CN='.$username); to try to find a match for the username in the group 'staff' (which is a subset of the 'User' group), then it finds no matches. if anyone can give some suggestions as to why this change turns up an empty result set, i'd appreciate hearing from you. thanks redmond [Thu, Oct 23, 2003 at 01:02:58PM -0700] This one time, at band camp, Justin Patrin said: > I've been getting entries from an Active Directory server through LDAP > for a while now. Here's some example code: > > //connect and bind > //$ds should be the handle returned from ldap_connect > > //Search LDAP for all users > // note, your OU entries may differ > $sr = ldap_search($ds, > 'OU=Employees,OU=Active Accounts,DC=whatever,DC=com', 'CN=*'); > > // Put the returned data into an array > $info = ldap_get_entries($ds, $sr); > > //loop through all the users and display their name > for($i = 0; $i < $info['count']; $i++) { > echo $info[$i]['cn'][0]."\n"; > } > > > If you need an LDAP Browser, I suggest Softerra LDAP Browser. It's very > nice for finding OU's and such. > > Justin Patrin > > > Redmond Militante wrote: > >hi all > > > >my first email to the list re: php/ldap/win2k AD garnered no responses. > >i've got most of the problem solved, however i can't get attributes from > >the ldap server. > > > >i have a login script that authenticates against our win2k active > >directory domain controller. i'm able to open a connection/bind/verify a > >password/and close the connection. i'm really having trouble returning a > >user's attributes (i'm mainly concerned with firstname and last name - cn > >and givenname). > > > >i've been trying for several days to return attributes. has anyone > >accomplished this with php? i can't find much relevant info for this > >particular problem on the internet. if you have any pointers, i'd > >appreciate hearing them. > > > >i'd post relevant code, but nothing i've tried works, and i'm not sure if > >the code i've tried is even valid... > > > >thanks > > > >redmond > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Redmond Militante Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386 3:15PM up 2 days, 1:16, 2 users, load averages: 0.01, 0.31, 0.55 ----- End forwarded message ----- -- Redmond Militante Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386 1:00PM up 6 days, 23:01, 2 users, load averages: 0.06, 0.06, 0.22
Attachment:
pgptPdnU7C7Sw.pgp
Description: PGP signature