0.0)
pear/Auth can optionally use package "pear/File_SMBPasswd"
pear/Auth can optionally use PHP extension "imap"
pear/Auth can optionally use PHP extension "vpopmail"
downloading Auth_HTTP-2.1.6.tgz ...
Starting to download Auth_HTTP-2.1.6.tgz (9,327 bytes)
.....done: 9,327 bytes
downloading Auth-1.3.0.tgz ...
Starting to download Auth-1.3.0.tgz (39,759 bytes)
...done: 39,759 bytes
install ok: channel://pear.php.net/Auth-1.3.0
install ok: channel://pear.php.net/Auth_HTTP-2.1.6
Once installed, you can begin taking advantage of Auth_HTTP??™s capabilities. For
purposes of demonstration, the following section considers how to authenticate
against the database.
Authenticating Against a MySQL Database
Because Auth_HTTP subclasses the Auth package, it inherits all of Auth??™s capabilities.
Because Auth subclasses the DB package, Auth_HTTP can take advantage of using this
popular database abstraction layer to store authentication information in a database
table. To store the information, this example uses a table identical to one used earlier
in this chapter:
CREATE TABLE logins (
id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(8) NOT NULL,
pswd VARCHAR(32) NOT NULL,
PRIMARY KEY(id));
Next, you need to create a script that invokes Auth_HTTP, telling it to refer to a
MySQL database. This script is presented in Listing 14-9.
Listing 14-9. Validating User Credentials with Auth_HTTP
require_once("Auth/HTTP.
Pages:
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456