[PHP] LDAP question PLEASE help me.

2001-07-17 Thread Johan Vikerskog (ECS)

People!

I am getting nuts here about this thing i am working on right now.
I am trying to get make a ldap php script that get information about a user.

I can connect to the ldap server and get response on how many entries that was found.
But how do i print out something of use.

I mean. How do i get all the information from the entrie?

I mean i do a ldap search and get the answer from my script that 1 entrie was found.
Now i want to print out that entry.
his email
first name, last name
department

etc etc

But how do i do that?
I am getting nuts.
If you dont know it perhaps you know a GOOD how to that i can use?
Please help me with this. Would be really usefull.

This script works and returns the amount of entries. Now i want to display the 
information.

echo h3LDAP query test/h3;
echo Connecting ...;
$ds=ldap_connect(localhost);  // must be a valid LDAP server!
echo connect result is .$ds.p;

if ($ds) { 
echo Binding ...; 
$r=ldap_bind($ds); // this is an anonymous bind, typically
   // read-only access
echo Bind result is .$r.p;

echo Searching for (sn=S*) ...;
// Search surname entry
$sr=ldap_search($ds,o=My Company, c=US, sn=S*);  
echo Search result is .$sr.p;

//Johan

-- 
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]




Re: [PHP] LDAP question PLEASE help me.

2001-07-17 Thread Reuben D Budiardja

Use ldap_get_entries. See here:

http://www.php.net/manual/en/function.ldap-get-entries.php

Check the bottom of your code, I put something in there.

On Tuesday 17 July 2001 07:27 am, Johan Vikerskog (ECS) wrote:
 People!
echo h3LDAP query test/h3;
 echo Connecting ...;
 $ds=ldap_connect(localhost);  // must be a valid LDAP server!
 echo connect result is .$ds.p;

 if ($ds) {
 echo Binding ...;
 $r=ldap_bind($ds); // this is an anonymous bind, typically
// read-only access
 echo Bind result is .$r.p;

 echo Searching for (sn=S*) ...;
 // Search surname entry
 $sr=ldap_search($ds,o=My Company, c=US, sn=S*);
 echo Search result is .$sr.p;

$result = ldap_get_entries($ds, $sr);
print_r($result);   // Let's just see what's in there.

Hope that helps.
Reuben D. Budiardja


 //Johan

--
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]