Advertisement
Guest User

Untitled

a guest
May 11th, 2016
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. $user = "domain\user";
  4. $pass = "password";
  5. $dn = "OU=...";
  6.  
  7. $time = microtime();
  8. $time = explode(" ", $time);
  9. $time = $time[1] + $time[0];
  10. $start = $time;
  11.  
  12. $ldap = $_GET['host'];
  13. $conn = ldap_connect($ldap) or die("Couldn't connect to AD!");
  14. ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
  15. $bind = ldap_bind($conn,$user,$pass) or die("can't bind");
  16. $attributes = array("displayname", "l");
  17. $filter = "(cn=*)";
  18. $result = ldap_search($conn, $dn, $filter, $attributes);
  19. $entries = ldap_get_entries($conn, $result);
  20. for ($i=0; $i<$entries["count"]; $i++)
  21. {
  22. echo $entries[$i]["displayname"]
  23. [0]."(".$entries[$i]["l"][0].")<br />";
  24. }
  25. ldap_unbind($conn);
  26. ldap_close($conn);
  27.  
  28.  
  29. $time = microtime();
  30. $time = explode(" ", $time);
  31. $time = $time[1] + $time[0];
  32. $finish = $time;
  33. $totaltime = ($finish - $start);
  34. printf ("This page took %f seconds to load.", $totaltime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement