11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 17 • <strong>PHP</strong> AND LDAPwww.it-ebooks.infoprintf("%s ", $component);?>This returns the following:5OU=PeopleOU=staffDC=adDC=exampleDC=comError HandlingAlthough we all like to think of our programming logic and code as foolproof, it rarely turns out that way.Therefore, you should use the functions introduced in this section because they help determine causesof error—and because they also provide your end users with pertinent information if an error occurs dueto inappropriate or incorrect user actions.Converting LDAP Error Numbers to MessagesThe ldap_err2str() function translates one of LDAP’s standard error numbers to its correspondingstring representation. Its prototype follows:string ldap_err2str(int errno)For example, error integer 3 represents the time limit exceeded error. Therefore, executing thefollowing function yields an appropriate message:echo ldap_err2str (3);This returns the following:Time limit exceededKeep in mind that these error strings might vary slightly, so if you’re interested in offering somewhatmore user-friendly messages, always base your conversions on the error number rather than on an errorstring.Retrieving the Most Recent Error NumberThe LDAP specification offers a standardized list of error codes generated during interaction with adirectory server. If you want to customize the otherwise terse messages offered by ldap_error() and364

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

Saved successfully!

Ooh no, something went wrong!