RE: [PEAR] Re: PEAR Auth: Duplicate usernames

From: Date: Thu, 04 Sep 2003 22:40:39 +0000
Subject: RE: [PEAR] Re: PEAR Auth: Duplicate usernames
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7595@lists.php.net to get a copy of this message
I did kind of the same thing, only temporary. Added a unique index and wrapped my addUser() call like this: if (PEAR::isError($add = $a->addUser('fred','fredpass'))) { echo 'there was an error<br>'; echo $add->getMessage(); } else { echo 'user added'; } But not being too good yet with PEAR Error, or Auth, I'm not sure if that's the best way. Andy > -----Original Message----- > From: jsWalter [mailto:jsWalter@torres.ws] > Sent: Thursday, September 04, 2003 6:07 PM > To: pear-general@lists.php.net > Subject: [PEAR] Re: PEAR Auth: Duplicate usernames > > I had the same issue. > > I just made the DB take care of it, but I agree with you. I would not like > to rely on the Auth container to do it. > > But, in the mean time, I did maake my DB column unique and I have soem > code > (see below) that makes that check using Auth methods. > > Walter > > $bolRet = $objAuth->addUser( 'test99', 'test' ); > > if (is_object($bolRet)) > { > echo 'status: ' . $bolRet->getCode(); // '-5' means User already exists > echo '<br />'; > echo 'status: ' . $bolRet->getMode(); > echo '<p />'; > } > > if (is_object($bolRet)) > { > if ($bolRet->getCode() == '-5') > { > $bolRet = false; > $bolRet['err'] = 'User Name already exists, please choose another.'; > } > else > echo 'Unknown error (' . $bolRet->getCode() . '). Please contact > membership administrator.'; > } > > echo '<p />'; > > if (is_array($bolRet)) > { > echo 'err obj: ' . $bolRet['err']; > echo '<p />'; > } > else > echo 'T'; > > > ?> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#7595) next »