Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $user = '<AD_User>'; // get from post
- $ldappass = '<AD_Password>'; // associated password
- // using ldap bind
- $ldaprdn = $user . '@<domain>.local'; // ldap rdn or dn
- $ldap_server = 'ldap://<domaindc>'; //domain controller
- // connect to ldap server
- $ldapconn = ldap_connect($ldap_server, 389)
- or die("Could not connect to LDAP server.");
- if ($ldapconn) {
- // binding to ldap server
- $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
- // verify binding
- if ($ldapbind) {
- echo "LDAP bind successful...";
- } else {
- echo "LDAP bind failed...";
- }
- }
- else{
- echo "LDAP Connection to " . $ldap_server . "failed";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement