Jump to content

Recommended Posts

Hey guys,

 

I've been working with PHP/MySQL for a long time but never had a chance of trying to use it in conjonction with LDAP. So, here I am.

 

I've tried to found the basics of it on the Net but now I seem so close to solving it, I thought maybe someone here could figure out it in secs.

 

I'm trying to retrieve informations with LDAP. The problem is I have no clue how to tell which info I want.

 

Here's the code I have atm :


// Connecting
$ds=ldap_connect("ldaps://uldc1.ulaval.ca");  // must be a valid LDAP server!

// Checkingif the connection worked
if ($ds)
{ 
// Binding
$r = ldap_bind($ds, "[email protected]", "password");

// Search entry
$sr = ldap_search($ds, "dc=ulaval,dc=ca,ou=comptes,ou=idul", "cn=_MAC01");

// Show the number of entries
echo "Number of entires returned is ".ldap_count_entries($r, $sr)."<br />";

// Getting entries
$info = ldap_get_entries($ds, $sr);

// Show data
echo "Data for ".$info["count"]." items returned:<br />";

for ($i=0; $i<$info["count"]; $i++)
	{
	echo "dn is: " . $info[$i]["dn"] . "<br />";
	echo "first cn entry is: " . $info[$i]["cn"][0] . "<br />";
	echo "first email entry is: " . $info[$i]["mail"][0] . "<br /><hr />";
	}

// Close the connection
ldap_close($ds);
}
else
{
echo "<h4>Unable to connect to LDAP server</h4>";
}

 

I'd like to get the info "logonCount" as shown in the screenshot.

 

Thanks for the tip!

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/198782-basic-ldap-php-question/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.