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

Source for file conf.php

Documentation is available at conf.php

  1. <?php
  2. // BC hack
  3. if (!defined('PATH_SEPARATOR')) {
  4.     if (defined('DIRECTORY_SEPARATOR'&& DIRECTORY_SEPARATOR == '\\'{
  5.         define('PATH_SEPARATOR'';');
  6.     else {
  7.         define('PATH_SEPARATOR'':');
  8.     }
  9. }
  10.  
  11. require_once 'PEAR.php';
  12.  
  13. // The error handling stuff is not needed and used only for debugging
  14. // while LiveUser is not yet mature
  15. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'eHandler');
  16.  
  17. function eHandler($errObj)
  18. {
  19.     echo('<hr /><span style="color: red">' $errObj->getMessage(':<br />'$errObj->getUserInfo('</span><hr />');
  20. }
  21.  
  22. // set this to the path in which the directory for liveuser resides
  23. // more remove the following two lines to test LiveUser in the standard
  24. // PEAR directory
  25. # $path_to_liveuser_dir = 'PEAR/'.PATH_SEPARATOR;
  26. # ini_set('include_path', $path_to_liveuser_dir.ini_get('include_path') );
  27.  
  28. $xml_is_readable is_readable('Auth_XML.xml');
  29. $xml_is_writable is_writable('Auth_XML.xml');
  30.  
  31. if ($xml_is_readable != false && $xml_is_writable != false{
  32.     $liveuserConfig = array(
  33.         'cookie'            => array(
  34.             'name' => 'loginInfo',
  35.             'path' => '',
  36.             'domain' => '',
  37.             'lifetime' => 30,
  38.             'savedir' => '.',
  39.             'secure' => false,
  40.         ),
  41.         'authContainers'    => array(
  42.             0 => array(
  43.                 'type' => 'XML',
  44.                 'loginTimeout' => 0,
  45.                 'expireTime'   => 3600,
  46.                 'idleTime'     => 1800,
  47.                 'allowDuplicateHandles'  => false,
  48.                 'passwordEncryptionMode' => 'MD5',
  49.                 'storage' => array(
  50.                     'file' => 'Auth_XML.xml',
  51.                     'alias' => array(
  52.                         'auth_user_id' =>   'userId',
  53.                         'passwd' =>         'password',
  54.                         'lastlogin' =>      'lastLogin',
  55.                         'is_active' =>      'isActive',
  56.                     ),
  57.                     'tables' => array(
  58.                         'users' => array(
  59.                             'fields' => array(
  60.                                 'lastlogin'         => false,
  61.                                 'is_active'         => false,
  62.                                 'owner_user_id'     => false,
  63.                                 'owner_group_id'    => false,
  64.                             ),
  65.                         ),
  66.                     ),
  67.                     'fields' => array(
  68.                         'lastlogin'         => 'timestamp',
  69.                         'is_active'         => 'boolean',
  70.                         'owner_user_id'     => 'integer',
  71.                         'owner_group_id'    => 'integer',
  72.                     ),
  73.                 ),
  74.            ),
  75.         ),
  76.         'permContainer'     => array(
  77.             'type'  => 'Simple',
  78.             'storage' => array('XML' => array('file' => 'Perm_XML.xml')),
  79.         ),
  80.     );
  81.     // Get LiveUser class definition
  82.     require_once 'LiveUser.php';
  83.  
  84.     // right definitions
  85.     define('COOKING',               1);
  86.     define('WASHTHEDISHES',         2);
  87.     define('WATCHTV',               3);
  88.     define('WATCHLATENIGHTTV',      4);
  89.     define('USETHECOMPUTER',        5);
  90.     define('CONNECTINGTHEINTERNET'6);
  91.  
  92.     // Create new LiveUser (LiveUser) object.
  93.     
  94.     $LU =LiveUser::factory($liveuserConfig);
  95.  
  96.     $handle = isset($_REQUEST['handle']$_REQUEST['handle': null;
  97.     $password = isset($_REQUEST['password']$_REQUEST['password': null;
  98.     $logout = isset($_REQUEST['logout']$_REQUEST['logout': null;
  99.     $remember = isset($_REQUEST['remember']$_REQUEST['remember': null;
  100.     if (!$LU->init($handle$password$logout$remember)) {
  101.         var_dump($LU->getErrors());
  102.         die();
  103.     }
  104.  
  105.     var_dump($LU->statusMessage($LU->getStatus()));
  106. }
  107.  
  108. ?>

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