donglinxia1541 2010-03-23 15:12 采纳率: 0%
浏览 142
已采纳

php / ldap - 绑定失败,但errorno不执行

I am trying to connect to ldap with a php web application. If the username/password is correct everything works fine however if the username/password is incorrect I get the following error:

PHP Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials

for some reason I am not able to look at the errorno or the state of the bind variable afterwards to print the appopriate user friendly error message.

any ideas?

  • 写回答

2条回答 默认 最新

  • dprlv04662 2010-03-23 15:22
    关注

    The problem is most likely that ldap_errno takes the ldap connection resource, and as ldap_bind failed you can't use it's result to retrieve the errno.

    Also: have you tried suppressing the error via the @ sign?

    e.g.:

    $ldapconn = ldap_connect("localhost");
    @$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
    
    if( $ldapbind )
    {
      // Everything went fine
    } else {
      // Use the connection resource for ldap_errno
      $errno = ldap_errno( $ldapconn );
    
      // Check the error number, print an error message (...)
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?