Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. $ldaprdn = 'myusername'; // ldap rdn or dn
  4. $ldappass = 'mypassword';
  5.  
  6. // connect to ldap server
  7. $ldapconn = ldap_connect("LDAP://myDomain")
  8. or die("Could not connect to LDAP server.");
  9.  
  10. ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
  11. ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
  12. if ($ldapconn) {
  13. var_dump(ldap_bind($ldapconn, $ldaprdn, $ldappass));
  14.  
  15. if ($ldapbind) {
  16. echo "LDAP bind successful...";
  17. } else {
  18. echo ldap_error($ldapconn);
  19. echo "LDAP bind failed...";
  20. }
  21.  
  22. }
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement