Hi Ray,


Thanks for your response. I was trying this script also but no success.

I was using following values:

$ldap[‘user’] = ‘tomar’;
$ldap[‘pass’] = ‘passwd’;
$ldap[‘host’] = ‘dc02-del3.vc-del.vcustomer.com’;
$ldap[‘port’] = 389;
$ldap[‘dn’]   = ‘cn’.$ldap[‘user’].’,ou=Department,o=Company Name’;
$ldap[‘base’] = ‘’;

but still getting same error message:

Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in /usr/local/
apache2/htdocs/test6.php on line 14



Do I need to do any specific change at ADS side or any extra parameter in dn side. Had you done any change in ADS server?


Thanks again for your help.

With Regards,

Kuldeep


Ray Hunter wrote:


On Tue, 2004-05-11 at 09:16, Kuldeep Singh Tomar wrote:


Hi,

Sorry for it. Can I get some help on this?



Here is what i used to query Exchange...now i am no windowz guru, but from what i understand about exchange and ads exchange will send user information to ads to be authenticated. So my work around was to all user to authenticate against exchange ldap, which in turn sends it to ads.

Just a note if the ldap can bind with the supplied username and password
then they were authenticated for their information.

--
Ray

Example:

<?php
// LDAP variables
$ldap[‘user’] = ‘uname’;
$ldap[‘pass’] = ‘password’;
$ldap[‘host’] = ‘ldap.example.com’;
$ldap[‘port’] = 389;
$ldap[‘dn’]   = ‘cn’.$ldap[‘user’].’,ou=Department,o=Company Name’;
$ldap[‘base’] = ‘’;

// connecting to ldap
$ldap[‘conn’] = ldap_connect( $ldap[‘host’], $ldap[‘port’] )
   or die( “Could not connect to server {$ldap[‘host’]} );

// binding to ldap
$ldap[‘bind’] = ldap_bind( $ldap[‘conn’], $ldap[‘dn’], $ldap[‘pass’] );

if( !$ldap[‘bind’] )
{
   echo ldap_error( $ldap[‘conn’] );
   exit;
}

// search for the user on the ldap server and return all
// the user information
$ldap[‘result’] = ldap_search( $ldap[‘conn’], $ldap[‘base’], ‘uid=’.$ldap[‘user’] );




if( $ldap[‘result’] ) { // retrieve all the entries from the search result $ldap[‘info’] = ldap_get_entries( $ldap[‘conn’], $ldap[‘result’] ); } else { echo ldap_error( $ldap[‘conn’] ); exit;

}

if( $ldap[‘info’] )
{
   // Add the user’s department name and email address
   // to the session
   $_SESSION[‘userdept’] = $ldap[‘info’][0][‘department’][0];
   $_SESSION[‘usermail’] = $ldap[‘info’][0][‘mail’][0];
}
else
{
   echo ldap_error( $ldap[‘conn’] );
   exit;
}

// close connection to ldap server
$ldap_close( $ldap[‘conn’] );

?>





-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to