Auth::Auth()

Auth::Auth() -- constructor

Synopsis

Auth::Auth (mixed $storageDriver [, mixed $options = "" [, string $loginFunction = "" [, boolean $showLogin = TRUE]]])

Description

Constructor for the authentication system.

The constructor will ensure that the PHP session management is started by calling session_start(). This is done as Auth requires a session to be active to operate correctly.

Parameter

string $storageDriver

name of the storage driver that should be used, alternatively you can pass a custom Auth_Container object.

mixed $options

the options that are passed to the storage container

string $loginFunction

the name of a user-defined function that prints the login screen

boolean $showLogin

defines if the login is optional or not

Note

This function can not be called statically.

See

Introduction - The storage drivers

Example

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.

Example

This example shows you how you can pass your own storage container to Auth.

If the storage containers supplied with Auth are not capable of fulfilling your requirements, you can easliy create your own storage container. Read the storage containers section for more info Introduction - The storage drivers