Re: PEAR Auth: Duplicate usernames
| From: | jsWalter | Date: | Thu, 04 Sep 2003 22:06:39 +0000 |
| Subject: | Re: PEAR Auth: Duplicate usernames | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7593@lists.php.net to get a copy of this message | ||
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';
?>