install / example 5 w/mysql question

Stacy Johnson <[email protected]> Mon, 21 Nov 2005 11:29:29 -0800
Newsgroups gmane.comp.php.pear.liveuser
Message-ID <[email protected]>
Hi, I apologize in advance if this is a silly newcomer question.

I am installing/using PEAR and LiveUser for the first time (on Windows, 
mind you), and I am having trouble getting the example 5 working 
properly with MySQL.  I have created the demo  liveuser_test_5 database 
and am connecting successfully. 

If I leave the example code alone, I get the following error:

*Fatal error*: Call to a member function init() on a non-object in 
*C:\wwwroot\reference\liveuser\example5\conf.php* on line *77
*
Which comes from this code:

--
$usr = LiveUser::singleton($conf);

$handle = (array_key_exists('handle', $_REQUEST)) ? $_REQUEST['handle'] 
: null;
$passwd = (array_key_exists('passwd', $_REQUEST)) ? $_REQUEST['passwd'] 
: null;
$logout = (array_key_exists('logout', $_REQUEST)) ? $_REQUEST['logout'] 
: false;
$remember = (array_key_exists('rememberMe', $_REQUEST)) ? 
$_REQUEST['rememberMe'] : false;

if (!$usr->init($handle, $passwd, $logout, $remember)) {  // LINE 77 HERE
    var_dump($usr->getErrors());
    die();
}

--

So I alter the singleton call to call it like the documention (in 
LiveUser.php) says:

//$usr = LiveUser::singleton($conf);
$usr =& LiveUser::singleton($conf);
          ^

And I get the same error.

So I change the singleton call to the factory call (like in the other 
examples):

//$usr = LiveUser::singleton($conf);
$usr =& LiveUser::factory($conf);

And now I get the login page, but when I actually try to login with 
JohnDoe JohnDoe (which is in the DB, I've checked), the processing 
script (admin.php) tells me 'Sorry but you cannot access this page'.    
Further decomposition of that script indicates that $usr->isLoggedIn() 
is failing (not a permissions problem but an actual login problem).

So I guess I have a barrage of questions:

1 - Has anyone else had this problem?
2 - Does it sound like an install/permissions problem?
3 - Should I be using singleton or factory there?
4 - Might there be a bug in $usr->isLoggedIn()?

Thanks in advance for any help,
-Stacy Johnson





-- 
Stacy Johnson
Ignite Analytics Corporation
[email protected]
m. 206-354-5591