Guest User

Untitled

a guest
May 5th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. $ldap_connection = ldap_connect('SERWER');
  2.  
  3. ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
  4. ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
  5. ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
  6.  
  7. $test=ldap_bind($ldap_connection);
  8.  
  9. if  ( $test ) { echo "OK"; }
  10.  
  11. $dn = "ou=xxx,DC=xxx,DC=xxx";
  12.  
  13. $filter="(&(objectCategory=person)(samaccountname=*))";
  14.  
  15. $sr=ldap_search($ldap_connection, $dn, $filter);
  16.  
  17. $info = ldap_get_entries($ldap_connection, $sr);
  18.  
  19. echo $info["count"]."\n";
Add Comment
Please, Sign In to add comment