Forums / Cotonti / Support / Password Generator

zboy812
#1 2010-04-15 02:05
Hello, i am making a plugin to batch create users in my cotonti system.

I want to add about 10,000 users to my system from a list of names, for example; Sara, John, Mike, John.....

I need to encrypt the passwords for the accounts to work. Where can i find the the password generator in the core?

Thank you!
Trustmaster
#2 2010-04-15 16:01
Use this function:
$randpass = sed_unique(16); // 16 is password length
May the Source be with you!
zboy812
#3 2010-04-16 11:37
Thank you trustmaster, i did find some MD5/Salt functions in the common.php i will try to use them and post back my results.
Kilandor
#4 2010-04-16 20:05
The password that is stored is just a pure MD5 hash of a string.

sed_unique is just something you can use to create a MD5 Hash, which can be used for something.

The example above will just create a random password. Which yes then you can use that as the "password" for the char.

$randpass = sed_unique(16); // 16 is password length
$passhash = md5($randpass);

$randpass is what you would login with
$passhash is what would be stored in the SQL field

If need help with how a normal registration goes, just checkout users.register.inc.php starting line 105~

You can use those 2 queries to create users. Just put them in a default group and not the inactive group.