<bdo id='sRExj'></bdo><ul id='sRExj'></ul>
    <legend id='sRExj'><style id='sRExj'><dir id='sRExj'><q id='sRExj'></q></dir></style></legend>
    1. <small id='sRExj'></small><noframes id='sRExj'>

    2. <tfoot id='sRExj'></tfoot>
      <i id='sRExj'><tr id='sRExj'><dt id='sRExj'><q id='sRExj'><span id='sRExj'><b id='sRExj'><form id='sRExj'><ins id='sRExj'></ins><ul id='sRExj'></ul><sub id='sRExj'></sub></form><legend id='sRExj'></legend><bdo id='sRExj'><pre id='sRExj'><center id='sRExj'></center></pre></bdo></b><th id='sRExj'></th></span></q></dt></tr></i><div id='sRExj'><tfoot id='sRExj'></tfoot><dl id='sRExj'><fieldset id='sRExj'></fieldset></dl></div>
      1. PHP LDAP 连接

        PHP LDAP Connection(PHP LDAP 连接)
          <legend id='si0W0'><style id='si0W0'><dir id='si0W0'><q id='si0W0'></q></dir></style></legend>

          <small id='si0W0'></small><noframes id='si0W0'>

        1. <tfoot id='si0W0'></tfoot>
            <tbody id='si0W0'></tbody>

            • <bdo id='si0W0'></bdo><ul id='si0W0'></ul>
              <i id='si0W0'><tr id='si0W0'><dt id='si0W0'><q id='si0W0'><span id='si0W0'><b id='si0W0'><form id='si0W0'><ins id='si0W0'></ins><ul id='si0W0'></ul><sub id='si0W0'></sub></form><legend id='si0W0'></legend><bdo id='si0W0'><pre id='si0W0'><center id='si0W0'></center></pre></bdo></b><th id='si0W0'></th></span></q></dt></tr></i><div id='si0W0'><tfoot id='si0W0'></tfoot><dl id='si0W0'><fieldset id='si0W0'></fieldset></dl></div>

                • 本文介绍了PHP LDAP 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 php-ldap 在 LDAP 中进行连接.我在使用 ldap_bind() 时遇到问题:

                  I'm trying to connect in LDAP with php-ldap. I got a issue using ldap_bind():

                  $username = 'josue.ruiz';
                  $password = 'pass';
                  $ldapconfig['host'] = '10.10.10.11';
                  $ldapconfig['port'] = 389;
                  $ldapconfig['basedn'] = 'dc=domain,dc=com';
                  
                  $ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
                  ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
                  ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
                  
                  $dn="cn=".$username.",ou=Technology,".$ldapconfig['basedn'];
                  
                  if ($bind=ldap_bind($ds, $dn, $password)) {
                      echo("Login correct");
                  } else {
                      echo("Login incorrect");
                  }
                  

                  我收到这条消息:

                  警告:ldap_bind():无法绑定到服务器:凭据无效...

                  Warning: ldap_bind(): Unable to bind to server: Invalid credentials in ...

                  但是当我尝试这种方式时:

                  But when I try this way:

                  ldap_bind($ds,'josue.ruiz@domain.com','pass'); 
                  

                  它工作正常,但对我来说它不起作用,因为我想按 OU 过滤,而这种方式我不能.有人对这个问题有什么建议吗?

                  It works fine, but to me it doesn't work because I want to filter by OU, and with this way I can't. Does anyone have any advice for this problem?

                  推荐答案

                  当您尝试执行 ldap_bind 时,您只是在连接并确定凭据是否有效.您需要做的是将您的域添加到用户名并让它连接.然后,如果您想使用 ldap_search() 确定用户是否是技术"OU,请考虑这样做:

                  When you are trying to do ldap_bind you are only connecting and determining if the credentials validate. What you need to do is add your domain to the username and let it connect. Then if you want to determine if the user is the 'Technology' OU with ldap_search() Consider doing it like this:

                  $domain = 'mydomain.com';
                  $username = 'josue.ruiz';
                  $password = 'pass';
                  $ldapconfig['host'] = '10.10.10.11';
                  $ldapconfig['port'] = 389;
                  $ldapconfig['basedn'] = 'dc=domain,dc=com';
                  
                  $ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
                  ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
                  ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
                  
                  $dn="ou=Technology,".$ldapconfig['basedn'];
                  $bind=ldap_bind($ds, $username .'@' .$domain, $password);
                  $isITuser = ldap_search($bind,$dn,'(&(objectClass=User)(sAMAccountName=' . $username. '))');
                  if ($isITuser) {
                      echo("Login correct");
                  } else {
                      echo("Login incorrect");
                  }
                  

                  这篇关于PHP LDAP 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                • <legend id='ZptZc'><style id='ZptZc'><dir id='ZptZc'><q id='ZptZc'></q></dir></style></legend>
                  • <bdo id='ZptZc'></bdo><ul id='ZptZc'></ul>

                        <tfoot id='ZptZc'></tfoot>

                            <i id='ZptZc'><tr id='ZptZc'><dt id='ZptZc'><q id='ZptZc'><span id='ZptZc'><b id='ZptZc'><form id='ZptZc'><ins id='ZptZc'></ins><ul id='ZptZc'></ul><sub id='ZptZc'></sub></form><legend id='ZptZc'></legend><bdo id='ZptZc'><pre id='ZptZc'><center id='ZptZc'></center></pre></bdo></b><th id='ZptZc'></th></span></q></dt></tr></i><div id='ZptZc'><tfoot id='ZptZc'></tfoot><dl id='ZptZc'><fieldset id='ZptZc'></fieldset></dl></div>

                              <tbody id='ZptZc'></tbody>

                            <small id='ZptZc'></small><noframes id='ZptZc'>