We proved it on the local network and worked well. If, for example, you use Ldap with Zentyal go https://serveriporname/Users/Composite/Settings , then use the options that it gives you in "User DN", so you take these addresses, which we will call $userdns , and you can prove the following code
<?php //The variables are implicit $ad = ldap_connect($ldap_server) ; //Ex: 10.0.0.1 ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3) ; //Using the provided user and password to login into LDAP server. //For the dc, normally will be the domain. $sr=ldap_search($ad, $userdns, "cn=*usuario*"); $info = ldap_get_entries($ad, $sr); for ($i=0; $i<$info["count"]; $i++) { /*Print out the user information here. If you rather to request by other field than cn take its name from here*/ print_r($info[$i]); echo "<p><hr/></p>"; } $ds = ldap_bind($ad,"uid=$ldap_user,$userdns",$ldap_pass); if($ds){ echo "<h4>$ldap_user connect to LDAP server \"$ldap_domain\"</h4>"; } else { echo "<h4>Unable to connect to LDAP server</h4>"; } ldap_close($ad); ?>
Eliux source share