Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 04:47 pm EST
Geeklog Forums
Help with mass user-add
Status: offline
amckay
Forum User
Full Member
Registered: 03/23/02
Posts: 180
Hey folks,
I have a file with a list of people to be added to a Geeklog site. I have no problem writing a program to parse out the info I need from the file, but what I cannot find is how to encrypt the password.
I want to do my own inserts into the USERS table. Near as I can see the UID is the most important field and it is automatically generated so I do not have to worry about it. In my source file is the desired password for each user but I was poking through the GL code and cannot find how to take that and encrypt it for storage in the DB.
Are there any other things I should be careful about when writing my own code for inserting users?
I have a file with a list of people to be added to a Geeklog site. I have no problem writing a program to parse out the info I need from the file, but what I cannot find is how to encrypt the password.
I want to do my own inserts into the USERS table. Near as I can see the UID is the most important field and it is automatically generated so I do not have to worry about it. In my source file is the desired password for each user but I was poking through the GL code and cannot find how to take that and encrypt it for storage in the DB.
Are there any other things I should be careful about when writing my own code for inserting users?
9
9
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Have you considered using the "Batch Add" option, available from the Admin's user list?
If you want to do it yourself, the code that creates a random password is in function emailpassword() in users.php
Also, you need to be careful to create all the necessary userXXX tables and add all new users to (at least) the Logged-In Users and All Users groups. Code to lift this from is in function createuser(), also in users.php
bye, Dirk
If you want to do it yourself, the code that creates a random password is in function emailpassword() in users.php
Also, you need to be careful to create all the necessary userXXX tables and add all new users to (at least) the Logged-In Users and All Users groups. Code to lift this from is in function createuser(), also in users.php
bye, Dirk
8
10
Quote
Status: offline
amckay
Forum User
Full Member
Registered: 03/23/02
Posts: 180
Thansk Dirk. Yeah, I saw batch-add but I have 2 problems.
(1) I need to give them a non-random password, mainly because
(2) I do not have an email address for everyone
I'll take a look at the code you've indicated - should be easy to figure out I hope.
cheers,
-Alan
(1) I need to give them a non-random password, mainly because
(2) I do not have an email address for everyone
I'll take a look at the code you've indicated - should be easy to figure out I hope.
cheers,
-Alan
9
9
Quote
Status: offline
amckay
Forum User
Full Member
Registered: 03/23/02
Posts: 180
OK, it looks like I can just copy createuser($username,$email) and add a 3rd parameter for the password I want.
A few changes later and I'm good to go.
There are only a few users in the list with no email addy so I'll log those and deal with them later.
Oh, yeah, one more thing - I have to add them all to a special group. Looks like in this function users get added to 2 groups, is that right. So all I have to do is create a 3rd one :
$normal_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='Logged-in Users'");
$all_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='All Users'");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($normal_grp, $uid)");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($all_grp, $uid)");
So I just make 2 more lines as above, right?
A few changes later and I'm good to go.
There are only a few users in the list with no email addy so I'll log those and deal with them later.
Oh, yeah, one more thing - I have to add them all to a special group. Looks like in this function users get added to 2 groups, is that right. So all I have to do is create a 3rd one :
Text Formatted Code
$normal_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='Logged-in Users'");
$all_grp = DB_getItem($_TABLES['groups'],'grp_id',"grp_name='All Users'");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($normal_grp, $uid)");
DB_query("INSERT INTO {$_TABLES["group_assignments"]} (ug_main_grp_id,ug_uid) values ($all_grp, $uid)");
So I just make 2 more lines as above, right?
10
11
Quote
Status: offline
Turias
Forum User
Full Member
Registered: 10/20/03
Posts: 807
Quote by amckay: BTW, what's the "User Submission Queue".
There seems to be lots to do about it in this function. Seems to be a lot of if/else statements that I can just cut away in my version of it.
There seems to be lots to do about it in this function. Seems to be a lot of if/else statements that I can just cut away in my version of it.
The User Submission Queue is similiar to the Story Submission Queue, Link Submission Queue, etc. It basically requires an admin to approve each account before it is fully activated.
12
8
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by amckay: BTW, what's the "User Submission Queue".
It's similar to the story submission queue, only for users. I.e. when activated (in config.php), new users need to be approved by an Admin before they get their password emailed to them. Prior to that, they are not able to log in.
Quote by amckay: OK, one final thing. Is there a function for deleting an account?
You could use the code from function deleteUserAccount() in usersetting.php (minus the first "if", which checks if the user id matches the currently logged-in user).
bye, Dirk
10
7
Quote
Status: offline
thedude
Forum User
Regular Poster
Registered: 12/28/02
Posts: 90
Hi Dirk.
I have stupid question for you.. Does it email to request to the admin email define in config.php? Or can it be define to forward the email to certain email address other than the one define in config.php.. ie: user admin? Please advise.
Many thanks..
The Dude
I have stupid question for you.. Does it email to request to the admin email define in config.php? Or can it be define to forward the email to certain email address other than the one define in config.php.. ie: user admin? Please advise.
Many thanks..
The Dude
10
24
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by thedude: Does it email to request to the admin email define in config.php? Or can it be define to forward the email to certain email address other than the one define in config.php.. ie: user admin?
What exactly are you referring to? The notifications emails sent when setting $_CONF['notification']? These are always sent to the address in $_CONF['site_mail'].
bye, Dirk
10
10
Quote
Hi Dirk.
Sorry for not being specific. I was referring to newuser account request. When someone apply for account access to your website, can the email somehow be directed to send the email to address other than $_CONF['site_mail']? Or do I need to manually hack it and create a different $_CONF['site_mail']. like $_CONF['newuser_mail']? Please advise. Thanks.
The Dude
Sorry for not being specific. I was referring to newuser account request. When someone apply for account access to your website, can the email somehow be directed to send the email to address other than $_CONF['site_mail']? Or do I need to manually hack it and create a different $_CONF['site_mail']. like $_CONF['newuser_mail']? Please advise. Thanks.
The Dude
9
11
Quote
All times are EST. The time is now 04:47 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content