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

Source for file config.inc.php

Documentation is available at config.inc.php

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

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