Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="index.php" method="POST">
- User:
- <input type="text" name="username" /><br>
- Pwd:
- <input type="password" name="password" /><br>
- <input type="submit" value="Login">
- </form>
- <?php
- $ldapServer = 'ldap://myServer';
- $ldapPort = myPort;
- $username = $_POST['username']."@myDomain.local";
- $password = $_POST['password'];
- $connect = ldap_connect($ldapServer, $ldapPort) or die("Connection failed!.");
- ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
- ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
- if (@ldap_bind($connect, $username, $password)) {
- echo "Authenticated";
- }
- else {
- echo "Wrong Username or Password";
- }
- 0 = ldap_set_option(ld, LDAP_OPT_ENCRYPT, 1)
- res = ldap_bind_s(ld, NULL, &NtAuthIdentity, NEGOTIATE (1158)); // v.3
- {NtAuthIdentity: User='myUserName'; Pwd=<unavailable>; domain = 'myDomain.local'}
- Authenticated as: 'MYDOMAINmyUser'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement