Re: Auth: two instances on the same page
| From: | Lorenzo Alberton | Date: | Wed, 19 Nov 2003 18:03:20 +0000 |
| Subject: | Re: Auth: two instances on the same page | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9025@lists.php.net to get a copy of this message | ||
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