Re: Auth: two instances on the same page
| From: | Jeroen Houben | Date: | Thu, 20 Nov 2003 10:41:35 +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-9057@lists.php.net to get a copy of this message | ||
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