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 'user';
  7. $db_pass '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.                     'user_id'    => 'auth_user_id',
  56.                     'handle'     => 'handle',
  57.                     'passwd'     => 'passwd',
  58.                     'lastlogin'  => 'lastlogin',
  59.                     'is_active'  => 'is_active'
  60.                 )
  61.             )
  62.         ),
  63.         'permContainer' => array(
  64.             'dsn'        => $dsn,
  65.             'type'       => 'DB_Medium',
  66.             'prefix'     => 'liveuser_'
  67.         )
  68.     );
  69.  
  70. function logOut()
  71. {
  72. }
  73.  
  74. function logIn()
  75. {
  76. }
  77.  
  78. PEAR::setErrorHandling(PEAR_ERROR_RETURN);
  79.  
  80. $usr LiveUser::singleton($conf);
  81. $usr->setLoginFunction('logIn');
  82. $usr->setLogOutFunction('logOut');
  83.  
  84. $e $usr->init();
  85.  
  86. if (PEAR::isError($e)) {
  87. //var_dump($usr);
  88.     die($e->getMessage(' ' $e->getUserinfo());
  89. }

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