O'Reilly logo

Learning PHP and MySQL by Jon A. Phillips, Michele E. Davis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Auth_HTTP to Authenticate

Similar to the way you use PEAR to improve and simplify database access, there's also a PEAR module called Auth_HTTP that streamlines the process of authenticating users against a database table. Because the code is prewritten, it reduces the risk that you'll make a mistake when authenticating users. You may notice that there's also a module called Auth. This module is similar to Auth_HTTP, except it displays the login screen using an HTML page instead of the pop-up authentication that Auth_HTTP uses.

As far as how it looks, the user can't tell that there is a difference between using the manually applied HTTP authentication dialogs that were previously used in this chapter and the Auth_HTTP module.

If you haven't already installed the Auth_HTTP module, you can do so by entering pear install Auth from the command line. But you must be logged in as root on a Unix host to do it. The pear install Auth command displays Example 13-17.

Example 13-17. pear install Auth output

downloading Auth-1.2.3.tgz ... Starting to download Auth-1.2.3.tgz (24,040 bytes) ........done: 24,040 bytes Optional dependencies: package `File_Passwd' version >= 0.9.5 is recommended to utilize some features. package `Net_POP3' version >= 1.3 is recommended to utilize some features. package `MDB' is recommended to utilize some features. package `Auth_RADIUS' is recommended to utilize some features. package `File_SMBPasswd' is recommended to utilize some features. install ok: Auth 1.2.3 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required