<?php // using ldap bind $ldaprdn = 'uname'; // ldap rdn or dn $ldappass = 'password'; // associated password // connect to ldap server $ldapconn = ldap_connect("ldap.example.com") 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..."; } } ?>
When your application is running, you need to access LDAP with Windows login credentials.
`AUTH_USER` request variable is the one which you have to check. This will hold your Windows login username and AUTH_USER will be MYDOMAINNAME\user.name
Is the username / password that I need for this an administrator credentials or any user on the system?
You can get the username yourself, not the password ... when the user logs into his windowed machine, we can verify his credentials using Environment.username in C #, and in PHP we can use AUTH_USER to verify that the user's login to the system is valid .
Plus, do you know where I can find a list of variables (e.g. auth_user) what information can I get?
http://in3.php.net/manual/en/ref.ldap.php
You can get a lot of information from the link above.
Thalaivar
source share