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

Source for file config_mdb2.inc.php

Documentation is available at config_mdb2.inc.php

  1. <?php
  2. // $Id: config_mdb2.inc.php,v 1.5 2004/06/19 18:04:46 arnaud Exp $
  3. require_once 'MDB2.php';
  4. require_once 'LiveUser.php';
  5. // Plase configure the following file according to your environment
  6.  
  7. $db_user 'root';
  8. $db_pass '';
  9. $db_host 'localhost';
  10. $db_name 'pear_test';
  11.  
  12. $dsn = "mysql://$db_user:$db_pass@$db_host/$db_name";
  13.  
  14. //$db = MDB2::connect($dsn, array('sequence_col_name' => 'id'));
  15. $db = MDB2::connect($dsn);
  16.  
  17. if (MDB2::isError($db)) {
  18.     echo $db->getMessage(' ' $db->getUserInfo();
  19. }
  20.  
  21. $db->setFetchMode(MDB2_FETCHMODE_ASSOC);
  22.  
  23.  
  24. $conf =
  25.     array(
  26.         'autoInit' => true,
  27.         'session'  => array(
  28.             'name'     => 'PHPSESSION',
  29.             'varname'  => 'ludata'
  30.         ),
  31.         'login' => array(
  32.             'method'   => 'post',
  33.             'username' => 'handle',
  34.             'password' => 'passwd',
  35.             'force'    => false,
  36.             'function' => '',
  37.             'remember' => 'rememberMe'
  38.         ),
  39.         'logout' => array(
  40.             'trigger'  => 'logout',
  41.             'redirect' => 'home.php',
  42.             'destroy'  => true,
  43.             'method' => 'get',
  44.             'function' => ''
  45.         ),
  46.         'authContainers' => array(
  47.             array(
  48.                 'type'          => 'MDB2',
  49.                 'name'          => 'MDB2_Local',
  50.                 'loginTimeout'  => 0,
  51.                 'expireTime'    => 3600,
  52.                 'idleTime'      => 1800,
  53.                 'dsn'           => $dsn,
  54.                 'allowDuplicateHandles' => 0,
  55.                 'authTable'     => 'liveuser_users',
  56.                 'authTableCols' => array(
  57.                      'required' => array(
  58.                         'auth_user_id' => array('type' => 'text''name' => 'auth_user_id'),
  59.                         'handle'       => array('type' => 'text''name' => 'handle'),
  60.                         'passwd'       => array('type' => 'text''name' => 'passwd')
  61.                      ),
  62.                      'optional' => array(
  63.                         'lastlogin'      => array('type' => 'timestamp''name' => 'lastlogin'),
  64.                         'is_active'      => array('type' => 'boolean',   'name' => 'is_active'),
  65.                         'owner_user_id'  => array('type' => 'integer',   'name' => 'owner_user_id'),
  66.                         'owner_group_id' => array('type' => 'integer',   'name' => 'owner_group_id')
  67.                      ),
  68.                     'custom' => array (
  69.                         'name'  => array('type' => 'text''name' => 'name'),
  70.                         'email' => array('type' => 'text''name' => 'email'),
  71.                      )
  72.                 )
  73.             )
  74.         ),
  75.         'permContainer' => array(
  76.             'dsn'        => $dsn,
  77.             'type'       => 'MDB2_Medium',
  78.             'prefix'     => 'liveuser_'
  79.         )
  80.     );
  81.  
  82. function logOut()
  83. {
  84. }
  85.  
  86. function logIn()
  87. {
  88. }
  89.  
  90. PEAR::setErrorHandling(PEAR_ERROR_RETURN);
  91.  
  92. $usr LiveUser::singleton($conf);
  93. $usr->setLoginFunction('logIn');
  94. $usr->setLogOutFunction('logOut');
  95.  
  96. $e $usr->init();
  97.  
  98. if (PEAR::isError($e)) {
  99. //var_dump($usr);
  100.     die($e->getMessage(' ' $e->getUserinfo());
  101. }

Documentation generated on Mon, 11 Mar 2019 13:56:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.