[pLog-general] Reserving Username.
Zaid B. Amireh
zamireh at albawaba.com
Thu Sep 22 09:04:09 GMT 2005
Thanks for the tip, here is what I did, I first created a simple script
that checks the mail db.
#!/usr/bin/php
<?php
$username = $argv[1];
$ret = 1;
$connection = mysql_connect('db-machine','sso', 'password');
if( $connection == false )
exit(0); //assume the worse
mysql_select_db('vpopmail', $connection);
$sql = "SELECT * FROM user WHERE us_name LIKE
'{$username}@fqdn.com'";
if( !($result = mysql_query( $sql, $connection )))
exit(0); //assume the worse
if( mysql_num_rows($result) > 0 ){
$ret = 0;
exit($ret); //found username!
}
exit($ret);
?>
and in class/summary/action/dousercreation.class.php I changed the code
that validates the username
// SSO checking for an already taken username
exec("/usr/local/bin/validate_mail_user.php $this->userName", $output,
$return_value);
// check if there is already a user with the same username and quit if so
$users = new Users();
if( $users->userExists( $this->userName ) || ($return_value == 0) ) {
$this->_view = new SummaryUserCreationView();
//$this->_form->hasRun( true );
$this->_form->setFieldValidationStatus( "userName", false );
$this->setCommonData( true );
return false;
}
I know that this is very ugly but its a beta testing stage and I don't
have much time to invest into this issue.
thank you all for your comments
with regards
Zaid Amireh
Mark Wu wrote:
>If your e-mail server is SMTP, maybe you can use some easy php script to
>check the user exist in e-mail or not instead of create a huge array.
>
>http://www.zend.com/zend/spotlight/ev12apr.php?article=ev12apr&kind=sl&id=56
>24&open=1&anc=0&view=1#notes
>
>It's all up to you.
>
>Mark
>
>
>
>>-----Original Message-----
>>From: plog-general-bounces at devel.plogworld.net
>>[mailto:plog-general-bounces at devel.plogworld.net] On Behalf
>>Of Zaid B. Amireh
>>Sent: Thursday, September 22, 2005 1:53 PM
>>To: plog-general at devel.plogworld.net
>>Subject: Re: [pLog-general] Reserving Username.
>>
>>Oscar Renalias wrote:
>>
>> >Hardcoding this into an array in a .php file might be a
>>better option. Take a look at class/data/validator/
>>
>>
>>>usernamevalidator.class.php, this is the class that is used
>>>
>>>
>>plog-wide for validating usernames. In the constructor there
>>is an array >called $forbiddenUsernamesArray, you probably
>>want to add in there your list of usernames.
>>
>>Thanks, I will into it right away.
>>
>>
>>Jon Daley wrote:
>>
>>
>>
>>>On Wed, 21 Sep 2005, Oscar Renalias wrote:
>>>
>>>
>>>
>>>>16.000????
>>>>Wow. So many?
>>>>
>>>>
>>> Yeah. What is your idea? I assume you have usernames from
>>>another system or something? Or just trying to avoid spammers? (:
>>>
>>>
>>>
>>well,
>>
>>we are working on 'single sign on' and I need to reserve the
>>usernames that already have an account on our email system
>>for now, later on I'll be creating 16,000 blogs for those
>>users! hehehe :D
>>
>>yours
>>
>>Zaid Amireh
>>_______________________________________________
>>pLog-general mailing list
>>pLog-general at devel.plogworld.net
>>http://devel.plogworld.net/mailman/listinfo/plog-general
>>
>>
>>
>
>_______________________________________________
>pLog-general mailing list
>pLog-general at devel.plogworld.net
>http://devel.plogworld.net/mailman/listinfo/plog-general
>
>
More information about the pLog-general
mailing list