Guest User

Untitled

a guest
Feb 11th, 2018
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. CN=Bob Smith,OU=Accounting,DC=mydomain,DC=net
  2.  
  3. DC=mydomain,DC=net
  4.  
  5. $connectionLDAP = "LDAP://localhost:54126";
  6. $basedn = 'DC=mydomain,DC=net';
  7. $ldap = ldap_connect($connectionLDAP) or die("Could not connect to LDAP server.");
  8. $username = $post['username'];
  9. $password = $post['password'];
  10. $usernameForBind = "CN=".$username.",OU=Accounting,".$basedn;
  11. ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
  12. ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
  13. $bind = ldap_bind($ldap, $usernameForBind, $password);
  14.  
  15. Warning: ldap_bind(): Unable to bind to server: Invalid credentials in C:....login.php on line 41
  16.  
  17. echo(ldap_error($ldap)."<br>");
  18. echo(ldap_errno($ldap)."<br>");
  19.  
  20.  
  21. Invalid credentials
  22. 49
  23.  
  24. $connectionLDAP = "ldap://localhost";
  25. $basedn = '@mydomain.net';
  26. $ldap = ldap_connect($connectionLDAP, 54126) or die("Could not connect to LDAP server.");
  27. $username = $post['username'];
  28. $password = $post['password'];
  29. $usernameForBind = $username.$basedn;
  30. ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
  31. ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
  32. $bind = ldap_bind($ldap, $usernameForBind, $password);
Add Comment
Please, Sign In to add comment