11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 17 • <strong>PHP</strong> AND LDAPwww.it-ebooks.infoBecause ldap_start_tls() is used for secure connections, new users often mistakenly attempt toexecute the connection using ldaps:// instead of ldap://. Note from the preceding example that usingldaps:// is incorrect, and ldap:// should always be used.Binding to the LDAP ServerOnce a successful connection has been made to the LDAP server (see the earlier section “Connecting toan LDAP Server”), you need to pass a set of credentials under the guise of which all subsequent LDAPqueries will be executed. These credentials include a username of sorts, better known as an RDN, orrelative distinguished name, and a password. To do so, you use the ldap_bind() function. Its prototypefollows:boolean ldap_bind(resource link_id [, string rdn [, string pswd]])Although anybody could feasibly connect to the LDAP server, proper credentials are often requiredbefore data can be retrieved or manipulated. This feat is accomplished using ldap_bind(), whichrequires at minimum the link_id returned from ldap_connect() and likely a username and passworddenoted by rdn and pswd, respectively. An example follows:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!