logo       

Re: Auth: two instances on the same page: msg#00355

php.pear.general

Subject: Re: Auth: two instances on the same page

Hi Lorenzo,

I was (am) using different session names, but that doesn't work. Logging into $auth1 logs me into $auth2 as well. Any ideas? I'm using the latest stable Auth with PHP4.3.4. Could explain how the code differentiates between two instances of Auth using the session_name() function? Perhaps then I'll understand what I'm doing wrong.

One question about the example you gave below: why do you set the sessionName again after you've already passed it through the constructor?

Thanks,

Jeroen

Lorenzo Alberton wrote:

On Wed, 19 Nov 2003 17:11:36 +0100, Jeroen Houben wrote:

Hi,


Is it possible to have two instances of Auth running on the same
page?


Of course it is, I've added a patch to set the session name
few months ago.

=======================
$auth1Params = array(
'table' => 'table1',
'usernamecol' => 'col1',
'passwordcol' => 'pwdcol1',
'dsn' => $dbinfo,
'sessionName' => '_AuthSession1'
);
$auth2Params = array(
'table' => 'table2',
'usernamecol' => 'col2',
'passwordcol' => 'pwdcol2',
'dsn' => $dbinfo,
'sessionName' => '_AuthSession2'
);

$auth1 = new Auth('MDB', $auth1Params, 'loginFunction');
$auth1->start();
$auth2 = new Auth('MDB', $auth2Params, 'loginFunction');
$auth2->setSessionname('PHP_AUTH2_SESS');
$auth2->start();

if ($auth1->checkAuth()) {
// some code
}
if ($auth2->checkAuth()) {
// some other code
}

=======================

This should work.

HTH
Lorenzo



--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise