1<?php 2require_once 'MDB2.php'; 3require_once 'LiveUser.php'; 4// Plase configure the following file according to your environment 5 6//$dsn = '{dbtype}://{user}:{passwd}@{dbhost}/{dbname}'; 7$dsn = 'mysql://root:@localhost/liveuser_test_example5'; 8 9$db = MDB2::connect($dsn); 10 11if (PEAR::isError($db)) { 12 echo $db->getMessage() . ' ' . $db->getUserInfo(); 13} 14 15$db->setFetchMode(MDB2_FETCHMODE_ASSOC); 16 17 18$conf = 19 array( 20 'debug' => true, 21 'session' => array( 22 'name' => 'PHPSESSION', 23 'varname' => 'ludata' 24 ), 25 'login' => array( 26 'force' => false, 27 ), 28 'logout' => array( 29 'destroy' => true, 30 ), 31 'authContainers' => array( 32 'DB' => array( 33 'type' => 'MDB2', 34 'expireTime' => 3600, 35 'idleTime' => 1800, 36 'storage' => array( 37 'dsn' => $dsn, 38 'prefix' => 'liveuser_', 39 'alias' => array( 40 'lastlogin' => 'lastlogin', 41 'is_active' => 'is_active', 42 ), 43 'fields' => array( 44 'lastlogin' => 'timestamp', 45 'is_active' => 'boolean', 46 ), 47 'tables' => array( 48 'users' => array( 49 'fields' => array( 50 'lastlogin' => false, 51 'is_active' => false, 52 ), 53 ), 54 ), 55 ) 56 ) 57 ), 58 'permContainer' => array( 59 'type' => 'Medium', 60 'storage' => array('MDB2' => array('dsn' => $dsn, 'prefix' => 'liveuser_')), 61 ), 62); 63