ldap_bind reports an error, please solve it
齐格飞啊飞
齐格飞啊飞 2021-11-01 15:09:22
0
2
1180

Dear heroes, every time I run $bd=ldap_bind($conn,$user,$password);//During user verification, if True, the IF statement will be run, but if it is wrong, it will not "Binding failed" in the IF will be displayed, but the following error will be displayed. What is the reason? Thank you.

PHP Warning: ldap_bind(): Unable to bind to server: Invalid credentials in J:\ReportData\ltest.php on line 13

The source code is as follows:

                  <?php

$host="172.27.108.1";

$port='389';

$ domain='globalnet';

$account='testuser1';

$password='P@ssw0rd01';

$user="{$account}@{ $domain}";

$conn=ldap_connect($host,$port);

if($conn){

ldap_set_option($ conn,LDAP_OPT_PROTOCOL_VERSION,3) or die ("Could not set LDAP Protocol version");//Declaration to use version 3

ldap_set_option($conn,LDAP_OPT_REFERRALS,0);//Binding to ldap server

$bd=ldap_bind($conn,$user,$password);//User verification

if($bd){

echo 'LDAP binding successful';

}

else

{

echo 'Binding failed';

}

} else{

echo 'Unable to connect'; #

齐格飞啊飞
齐格飞啊飞

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template