Re: LiveUser - Problems Can't get it to login (Can't view last post)
| From: | Hector Partidas | Date: | Fri, 07 Apr 2006 12:51:40 +0000 |
| Subject: | Re: LiveUser - Problems Can't get it to login (Can't view last post) | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23570@lists.php.net to get a copy of this message | ||
No errors were thrown. infact, its always cycling twice, its not just the
foreach, its always cycling twice for some reason unknown to me. Here is the
Code i'm working with, its off the gvngroup site, been trying to get it to
work.
require_once 'MDB2.php';
require_once 'LiveUser/LiveUser.php';
$db_name = 'root';
$db_password = '';
$db_server = 'localhost';
$db_database = 'lu_test';
$dsn ='mysql://' . $db_name . ':' . $db_password . '@' . $db_server .
'/' .
$db_database . '';
$db =& MDB2::connect($dsn);
if (PEAR::isError($db))
{
echo $db->getMessage() . ' ' . $db->getUserInfo();
}
$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
$conf = array(
//'autoInit' => true,
'debug' => true,
'session' => array(
'name' => 'TWF', // liveuser session name
'varname' => 'ludata', // liveuser session var
name
'force_start' => true
),
'login' => array(
'force' => true, // should the user be
forced to login
'regenid' => true,
),
'logout' => array(
'destroy' => true // whether to destroy the
session on logout
),
'cookie' => array(
'name' => 'loginInfo', // name of the Remember me cookie
'lifetime' => 30, // cookie lifetime in days
'path' => null, // cookie path ?
'domain' => null, // cookie domain ?
'savedir' => '.', // absolute path to writeable directory
?
// (no trailing slash)
'secure' => false, // whether cookie only send over secure
connection
),
'authContainers' => array(
'TWF' => array(
'type' => 'MDB2',
'expireTime' => 1800,
'idleTime' => 300,
'storage' => array(
'dsn' => $dsn,
'force_seq' => false,
'alias' => array(
'auth_user_id' => 'authUserId',
'lastlogin' => 'lastLogin',
'is_active' => 'isActive',
'owner_user_id' => 'owner_user_id',
'owner_group_id' => 'owner_group_id',
),
'fields' => array(
'auth_user_id' => 'integer',
'lastlogin' => 'timestamp',
'is_active' => 'boolean',
'owner_user_id' => 'integer',
'owner_group_id' => 'integer',
),
'tables' => array(
'users' => array(
'fields' => array(
'lastlogin' => null,
'is_active' => null,
'owner_user_id' => null,
'owner_group_id' => null,
),
),
),
),
),
),
'permContainer' => array(
'type' => 'Complex',
'storage' => array(
'MDB2' => array(
'dsn' => $dsn,
'prefix' => 'liveruser_',
'force_seq' => false,
'fields' => array(
'auth_user_id' => 'integer',
),
),
),
),
);
//PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$LU =& LiveUser::singleton($conf);
$LU->init();
if (!$LU->init()) {
var_dump($LU->getErrors());
die();
}
$handle = (array_key_exists('handle', $_POST)) ? $_POST['handle'] : NULL;
$passwd = (array_key_exists('passwd', $_POST)) ? $_POST['passwd'] : NULL;
$logout = (array_key_exists('logout', $_GET)) ? $_GET['logout'] : false;
$remember = (array_key_exists('rememberMe', $_POST)) ? $_POST['rememberMe']
: false;
if ($logout)
{
// $LU->logout(true);
$LU->logout(false); // does not delete the
RememberMe cookie
}
elseif(!$LU->isLoggedIn() || ($handle && $LU->getProperty('handle') !=
$handle))
{
if (!$handle)
{
$LU->login(NULL, NULL, true);
}
else
{
$LU->login($handle, $passwd, false);
}
}
On 4/7/06, Lukas Smith <lsmith@php.net> wrote:
>
> Hector Partidas wrote:
>
> > After the foreach is done, on line 1048 if (!$this->isLoggedIn()) { --
> this
> > is where the problem comes in, before this line, $login == 1 post that
> it
> > returns false.
> >
> > I was reading over the login function and it doesn't set $this->_auth,
> so as
> > soon as it hits that line it boots me.
>
> did you check getErrors()?
> seems to me like the init() method inside the auth container caused some
> error.
>
> regards,
> Lukas
>
>
>
>
--
Atentamente,
Héctor Partidas
Desarrollador
tuWebFacil.com