hello

thanks for replying.  i think i'm almost there...

here's what i've tried so far...

<? 

//connect

if($ds = ldap_connect("my.domaincontroller.com")){
                    echo "connected successfully<br>";}
                                        else {echo "error connecting<br>";}

//bind
if ( [EMAIL PROTECTED]("my.domaincontroller.com")) {
                                        echo "bind successful<br>";}
                                        else {echo "error binding<br>";}

//the connect and bind above work successfully when executed on their own
//now, i'm going to try and get attributes

//Search LDAP for all users
// note, your OU entries may differ
$sr = ldap_search($ds,"ou=users,dc=my.domaincontroller.com,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";
}


?> 

the above code basically tells me that i'm connecting and binding, but returns no 
attributes. is there anything i'm missing?

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
> 

-- 
FreeBSD 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #0: Fri Oct 3 21:30:51 CDT 2003
 9:00AM  up 10 days, 41 mins, 5 users, load averages: 1.00, 1.00, 1.00
 
Once upon a time, when I was training to be a mathematician, a group of
us bright young students taking number theory discovered the names of
the smaller prime numbers.

2:  The Odd Prime --
        It's the only even prime, therefore it's odd.  QED.
3:  The True Prime --
        Lewis Carroll: "If I tell you three times, it's true."
31: The Arbitrary Prime --
        Determined by unanimous unvote.  We needed an arbitrary prime
        in case the prof asked for one, and so had an election.  91
        received the most votes (well, it *looks* prime) and 3+4i the
        next most.  However, 31 was the only candidate to receive none
        at all.

Since the composite numbers are formed from primes, their qualities are
derived from those primes.  So, for instance, the number 6 is "odd but
true", while the powers of 2 are all extremely odd numbers.
 

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to