Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $adServer = "ldap://WEB-SERVER.domain.com";// set the connection path...
- session_start();// Set if login is required...
- $ldap = ldap_connect($adServer);
- $ldap_id[] = $ldap;
- $username = 'username';//username for binding...
- $password = 'password';//password for bindind...
- $ldaprdn = 'domain' . "\" . $username;
- ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);//ldap version...
- ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
- $bind = @ldap_bind($ldap, $ldaprdn, $password);//Binding with user...
- if ($bind)
- {
- echo 'connection successful.';
- //Codes tobe executed...
- ldap_unbind($ldap); // Unbind...
- }
- else
- {
- echo 'connection unsuccessful';
- ?>
Add Comment
Please, Sign In to add comment