note 41429 deleted from function.ldap-connect by nlopess
| From: | nlopess@php.net | Date: | Fri, 09 Apr 2004 19:13:05 +0000 |
| Subject: | note 41429 deleted from function.ldap-connect by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-67909@lists.php.net to get a copy of this message | ||
Note Submitter: sco@postmaster.co.uk
----
Like the user above, I'm getting a resource ID returned under all circumstances - even when the
server doesn't exist, so I'm using ldap_error to check that a connection has been
established with the server.
$ldap=ldap_connect('hostname');
$myLdap=@ldap_bind($ldap,'CN='.$username.',CN=SBS',$password);
if(ldap_error($ldap)=="Can't contact LDAP server") {
$this->auth=false;
$this->code=-1;
$this->message='Connection to LDAP server failed.';
}