Can someone shed some light on why one of the these scripts would work and one would not? they are both doing an ldap bind but need the first one to work but cannot seem to figure out why it is failing…
This one is not working…
[php]
<?php // version = CONADS.2.0 /* initialise LDAP-TLS connection */ // ERRORS HERE REALLY NEED TO BE REPORTED TO THE BROWSER. ini_set('display_errors', 0); error_reporting(E_ALL); $svr1="ldap://ad.testdomain.local"; $usr="[email protected]"; $pwd="XXXXXXX"; $LDAP=ldap_connect($svr1); $Bind=false; if(ldap_set_option($LDAP, LDAP_OPT_PROTOCOL_VERSION, 2)) if(ldap_set_option($LDAP, LDAP_OPT_REFERRALS, 0)) if(ldap_start_tls($LDAP)) $Bind = @ldap_bind($LDAP, $usr, $pwd); #ldap_close($LDAP); if(!$Bind){ echo "Unfortunately, there has been a binding error
"; die; } else echo ""; //horizontal line printed is an immediate indication that the LDAP bind works - simple enough /*form data loader stuff */ $loadedname = $_GET['user']; ?>
[/PHP]
and this one works…
[PHP]
<?php // using ldap bind $ldaprdn = '[email protected]'; // ldap rdn or dn $ldappass = 'XXXXX'; // associated password // connect to ldap server $ldapconn = ldap_connect("ldap://ad.testdomain.local") 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..."; } } ?>[/PHP]
Thanks,
Gavin…