Ok. That makes sense. I have the structure printed out, so I shouldn't have
a problem.

> From: "Nick Talbott" <[EMAIL PROTECTED]>
> Date: Thu, 8 Mar 2001 08:21:15 -0000
> To: "Mike Tuller" <[EMAIL PROTECTED]>, "php mailing list"
> <[EMAIL PROTECTED]>
> Subject: Re: [PHP]  ldap_search()
> 
> Mike
> 
> The purpose of setting the basedn is to say "search in this branch of the
> directory".
> 
> The only person who can really tell you what basedn to use is whoever
> designed or manages the structure of your LDAP server.  Having said that, a
> base dn is commony something like ...
> o=Your Organisation,c=US
> 
> Some LDAP managers also make consistent use of the "ou" or
> "organizationalUnit" attribute to provide a further logical division of the
> directory.  If your directory is organised this way, and you want to
> restrict your search to just one ou in the organisation, you might set the
> basedn for the search to be
> ou=Whatever Section,o=Your Organisation,c=US
> 
> HTH
> 
> Nick Talbott
> IT Policy and Strategy Manager, Powys County Council, UK
> 
> email [EMAIL PROTECTED]
> FAX +44 (0) 1597 824781
> web http://www.powys.gov.uk and http://www.powysweb.co.uk
> 
> 
> -----Original Message-----
> From: Mike Tuller <[EMAIL PROTECTED]>
> To: php mailing list <[EMAIL PROTECTED]>
> Date: 08 March 2001 01:03
> Subject: [PHP] ldap_search()
> 
> 
>> Sorry about this, but I don't know much about LDAP, and the book I have
>> doesn't tell me much.
>> 
>> I was shown the following script to grab information from an LDAP server
> and
>> display the results in a phonebook type format.
>> 
>> <HTML>
>> <BODY>
>> <?php
>> $ldapserver = "ldap.something.com";
>> $basedn = "dc=something, dc=com";
>> 
>> $dir =ldap_connect($ldapserver);    // Connect to server
>> 
>> if ($dir) {
>>  ldap_bind($dir);              // Bind to the server
>>  $result = ldap_search($dir, $basedn, "sn=*");  // query connection, set
>> the base and look for any sn
>> 
>>  $info = ldap_get_entries($dir, $result);  // The results get sent to the
>> $info object
>> 
>>  for ($i=0; $i<$info["count"]; $i++) {    // Count is a ldap feature that
>> contains the length of the resultset
>>    echo $info[$i]["cn"][0];     // choose any parameter you want see here
>>  }
>> 
>>  ldap_close($dir);
>> }
>> ?>
>> </BODY>
>> </HTML>
>> 
>> 
>> The problem I am running into I think is that I work for a school district,
>> and I don't have a .com address. I have anoka.k12.mn.us. I tried to put in
>> $basedn = "dc=anoka, dc=k12, dc=mn, dc=us"; but I still receive an error on
>> ldap_search. Am I doing this correctly?
>> 
>> Mike
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to