Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <form action="index.php" method="POST">
  2. User:
  3. <input type="text" name="username" /><br>
  4. Pwd:
  5. <input type="password" name="password" /><br>
  6. <input type="submit" value="Login">
  7. </form>
  8.  
  9. <?php
  10.  
  11. $ldapServer = 'ldap://myServer';
  12. $ldapPort = myPort;
  13. $username = $_POST['username']."@myDomain.local";
  14. $password = $_POST['password'];
  15.  
  16. $connect = ldap_connect($ldapServer, $ldapPort) or die("Connection failed!.");
  17. ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
  18. ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
  19.  
  20. if (@ldap_bind($connect, $username, $password)) {
  21. echo "Authenticated";
  22. }
  23. else {
  24. echo "Wrong Username or Password";
  25. }
  26.  
  27. 0 = ldap_set_option(ld, LDAP_OPT_ENCRYPT, 1)
  28. res = ldap_bind_s(ld, NULL, &NtAuthIdentity, NEGOTIATE (1158)); // v.3
  29. {NtAuthIdentity: User='myUserName'; Pwd=<unavailable>; domain = 'myDomain.local'}
  30. Authenticated as: 'MYDOMAINmyUser'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement