<?php require_once "Auth/Auth.php"; function myOutput($username, $status) { ... /** See example 1 for the full listing */ } $params = array( "dsn" => "mysql://martin:test@localhost/auth", "table" => "myAuth", "usernamecol" => "myUserColumn", "passwordcol" => "myPasswordColumn" ); $a = new Auth("DB", $params, "myOutput"); $a->start(); if ($a->getAuth()) { echo "You have been authenticated successfully."; } ?>
This example shows you how you can specifiy alternative names for the database table and the column names. In our example, we use the table myAuth, select the username from the field myUserColumn and the password from the field myPasswordColumn. The default values for this fields are auth, username and password. Note that you can also specify an existing DB object with the dsn parameter instead of a DSN.
This feature is necessary if you want to use PEAR::Auth with a database layout that is different from the one PEAR::Auth uses by default.
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?