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.         'authContainers'    => array(
  34.             0 => array(
  35.                 'type' => 'XML',
  36.                 'loginTimeout' => 0,
  37.                 'expireTime'   => 3600,
  38.                 'idleTime'     => 1800,
  39.                 'allowDuplicateHandles'  => false,
  40.                 'passwordEncryptionMode' => 'MD5',
  41.                 'storage' => array(
  42.                     'file' => 'Auth_XML.xml',
  43.                     'alias' => array(
  44.                         'auth_user_id' => 'userId',
  45.                         'passwd' => 'password',
  46.                         'lastlogin' => 'lastLogin',
  47.                         'is_active' => 'isActive',
  48.                     ),
  49.                 ),
  50.            ),
  51.         ),
  52.         'permContainer'     => array(
  53.             'type'  => 'Simple',
  54.             'storage' => array('XML' => array('file' => 'Perm_XML.xml')),
  55.         ),
  56.     );
  57.     // Get LiveUser class definition
  58.     require_once 'LiveUser.php';
  59.  
  60.     // right definitions
  61.     define('COOKING',               1);
  62.     define('WASHTHEDISHES',         2);
  63.     define('WATCHTV',               3);
  64.     define('WATCHLATENIGHTTV',      4);
  65.     define('USETHECOMPUTER',        5);
  66.     define('CONNECTINGTHEINTERNET'6);
  67.  
  68.     // Create new LiveUser (LiveUser) object.
  69.     
  70.     $LU =LiveUser::factory($liveuserConfig);
  71.  
  72.     $handle = isset($_REQUEST['handle']$_REQUEST['handle': null;
  73.     $password = isset($_REQUEST['password']$_REQUEST['password': null;
  74.     $logout = isset($_REQUEST['logout']$_REQUEST['logout': null;
  75.     $remember = isset($_REQUEST['remember']$_REQUEST['remember': null;
  76.     if (!$LU->init($handle$password$logout$remember)) {
  77.         var_dump($LU->getErrors());
  78.         die();
  79.     }
  80.  
  81.     var_dump($LU->statusMessage($LU->getStatus()));
  82. }
  83.  
  84. ?>

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