Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17240 программистов и 1834 робота. Сейчас ищет 1701 программист ...

Auth_Container_MDB2

Вернуться к: Auth

Auth_Container_MDB2

Auth_Container_MDB2 – Authenticate against a database using MDB2

This container makes use of PEAR::MDB2 abstraction layer for database access. That means that you can use all databases that are supported by the MDB2 abstraction layer to store the login data.

The storage-specific argument for the Auth constructor() is an array of options.

Available Options
Option Data Type Default value Description
"dsn" string " A valid and well-formed DSN .
"table" string "auth" The name of the database table, where the authorization data is stored.
"usernamecol" string "username" The name of the column, where the username is stored
"passwordcol" string "password" The name of the column, where the crypted password is stored.
"db_fields" array array() An array of extra fields to retrieve when loading the user details.
"cryptType" string "md5" The encryption type the password is stored in.
"auto_quote" boolean TRUE Whether to enable automatic quoting of database table and field names.
"db_options" array array() An array of options to be passed to the PEAR::MDB2 constructor. See PEAR::MDB2 for more information.
"db_where" string " A string to be appended to the WHERE clause of queries against the database. It is appended to the queries used in fetchData(), listUsers(), removeUser() and changePassword(). Available since Auth 1.5.0.

By default, MDB2's default portability setting of MDB2_PORTABILITY_ALL is used. This setting may cause unexpected behaviour, such as field names being converted to lowercase regardless of their definition in the database schema. The "db_options" option can be used to override this, as shown in the following example.

Example overriding MDB2's default portability

<?php
$options 
= array('dsn'         => 'mysql://user:password@localhost/database',
                 
'usernamecol' => 'UserName',
                 
'passwordcol' => 'PassWord',
                 
'db_options'  => array('portability' => MDB2_PORTABILITY_ALL MDB2_PORTABILITY_FIX_CASE)
                );
$auth = new Auth('MDB2'$options'loginFunction');
?>


Вернуться к: Auth

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware