LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Source for file conf.php

Documentation is available at conf.php

  1. <?php
  2. require_once 'MDB2.php';
  3. require_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.  
  11. if (PEAR::isError($db)) {
  12.     echo $db->getMessage(' ' $db->getUserInfo();
  13. }
  14.  
  15. $db->setFetchMode(MDB2_FETCHMODE_ASSOC);
  16.  
  17.  
  18. $conf =
  19.     array(
  20.         'autoInit' => false,
  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.                 'loginTimeout'  => 0,
  35.                 'expireTime'    => 3600,
  36.                 'idleTime'      => 1800,
  37.                 'allowDuplicateHandles' => 0,
  38.                 'storage' => array(
  39.                     'dsn' => $dsn,
  40.                     'alias' => array(
  41.                         'lastlogin' => 'lastlogin',
  42.                         'is_active' => 'is_active',
  43.                     ),
  44.                     'fields' => array(
  45.                         'lastlogin' => 'timestamp',
  46.                         'is_active' => 'boolean',
  47.                     ),
  48.                     'tables' => array(
  49.                         'users' => array(
  50.                             'fields' => array(
  51.                                 'lastlogin' => false,
  52.                                 'is_active' => false,
  53.                             ),
  54.                         ),
  55.                     ),
  56.                 )
  57.             )
  58.         ),
  59.     'permContainer' => array(
  60.         'type' => 'Medium',
  61.         'storage' => array('MDB2' => array('dsn' => $dsn'prefix' => 'liveuser_')),
  62.     ),
  63. );
  64.  
  65. PEAR::setErrorHandling(PEAR_ERROR_RETURN);
  66.  
  67. $usr LiveUser::singleton($conf);
  68.  
  69. $handle (isset($_REQUEST['handle'])) $_REQUEST['handle': null;
  70. $passwd (isset($_REQUEST['passwd'])) $_REQUEST['passwd': null;
  71. $logout (isset($_REQUEST['logout'])) $_REQUEST['logout': false;
  72. $remember (isset($_REQUEST['rememberMe'])) $_REQUEST['rememberMe': false;
  73.  
  74. if (!$usr->init($handle$passwd$logout$remember)) {
  75.     var_dump($usr->getErrors());
  76.     die();
  77. }

Documentation generated on Mon, 11 Mar 2019 14:18:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.