Bulk Add Users

Discussion forum for MOD Writers regarding MOD Development.
User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: Bulk Add Users

Post by Mighty Gorgon »

CSV seems to be properly formatted, that is really strange.

Make sure the php file is saved properly: correct start and end, no extra white spaces at beginning or end, correct linebreaks and encoding...

Sorry but I don't have any other clue. :(
hammi99
Registered User
Posts: 5
Joined: Sun Sep 21, 2008 9:37 pm

Re: Bulk Add Users

Post by hammi99 »

ok thanks anyway. i'll let you know if i ever figure it out!
dvbshop
Registered User
Posts: 2
Joined: Mon Oct 13, 2008 8:34 am

Re: Bulk Add Users

Post by dvbshop »

Short question ...

it could happen, that in the NEW database the user already exists and you try to import the old database.
Then an error is shown:

Duplicate entry 'spricer12345' for key 2 [1062]


INSERT INTO phpbb_users (username, username_clean, user_password, user_pass_convert, user_email, user_email_hash, group_id, user_type, user_permissions, user_timezone, user_dateformat, user_lang, user_style, user_actkey, user_ip, user_regdate, user_passchg, user_options, user_inactive_reason, user_inactive_time, user_lastmark, user_lastvisit, user_lastpost_time, user_lastpage, user_posts, user_dst, user_colour, user_occ, user_interests, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_message_rules, user_full_folder, user_emailtime, user_notify, user_notify_pm, user_notify_type, user_allow_pm, user_allow_viewonline, user_allow_viewemail, user_allow_massemail, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield, user_form_salt) VALUES ('spricer12345', 'spricer12345', '$H$76kX1whTt1KfzxuRqN8uPSEzMGGXse0', 0, 'wouldbean.email', '162349476417', '2', '0', '', '1', 'd M Y H:i', 'en', 3, '', '', 1224513374, 1224513374, 895, 0, 0, 1224513374, 0, 0, '', 0, 1, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1, 0, 1, 1, 1, 1, '', '', '', '552f24ef9b16ffb5')

Would be glad, if someone could change the script in a way, that EXISTING users are not "overwritten" or updated, just being "unconsidered" for import.
lalan7
Registered User
Posts: 1
Joined: Sun Mar 01, 2009 4:44 pm

Re: Bulk Add Users

Post by lalan7 »

The script is working fine but i get something weird in the phpbb_users`.`username` field.

the username have a /0 before de username.

example:

\0User 01 user 01 $H$9Q8iKBnrJn5xH/rKgMcHTGAPXTQ8kc1 1235855008 0 [email protected] en


this is my users_to_add.csv

"User 01",123456,"[email protected]",2,"en",0

Someone know what in causing this?

Thanks
MarudaGDA
Registered User
Posts: 20
Joined: Wed Mar 10, 2010 7:08 pm

Re: Bulk Add Users

Post by MarudaGDA »

I've tried the code that was published by harley1979fxe, and I have a strange problem. Everything seem to be working (almost) fine, untill the line include comes.

When I launch the file without include lines, just to test the CSV file explode function - everything is going just fine. When I add the include functions for common.php, functions.php, functions_user.php the program seem to stop working at the end of include section.

Do I have to split the file, i don't know, put something that will give the parser informations, that the declaring section is over?

Another problem I have, is trouble with handling CSV file. I've copy/paste teh script into Embacadero Delphi for PHP 2.0 (to have lines couloure3d etc.), and after creating this file, and running it in my browser, one problem appeared. The script is no longer able to tell ,ehen the file is ending. It is able to read and explode all 120 users, but then I get THOUSANDS of empty records. I don't get it. is the program, where you're creating your script THAT important? I don't think so.

One more thing: is authentication a 'must be'. Or will the user_add() function work, when it's called from the file in root dir, even if no administrator is logged in, authenticated?

Thanks!
MarudaGDA
Amateur phpBB forum Admin - not that hard! Just 200h of testing and almost everything works! :D
JBridge
Registered User
Posts: 20
Joined: Mon Oct 11, 2004 7:15 am

Re: Bulk Add Users

Post by JBridge »

Is there a SQL command we can use to insert new member into data table?
User avatar
cwt
Registered User
Posts: 32
Joined: Wed Dec 12, 2007 1:21 pm
Location: LaLaLand (Los Angeles, CA)
Name: Phill Cross
Contact:

Re: Bulk Add Users

Post by cwt »

SQL ERROR [ mysql4 ]

Column 'config_value' cannot be null [1048]

SQL

INSERT INTO config (config_name, config_value, is_dynamic) VALUES ('newest_user_colour', NULL, 1)

BACKTRACE

FILE: [ROOT]/includes/db/mysql.php
LINE: 175
CALL: dbal->sql_error()

FILE: [ROOT]/includes/functions.php
LINE: 157
CALL: dbal_mysql->sql_query()

FILE: [ROOT]/includes/functions_user.php
LINE: 325
CALL: set_config()

FILE: [ROOT]/users_add.php
LINE: 96
CALL: user_add()
I get this message? I followed the above instructions...

I am attempting to add 880 new members

USING:
Database server: MySQL 5.0.95
Board version: 3.0.10
User avatar
Saldash
Registered User
Posts: 619
Joined: Mon Nov 10, 2008 8:08 am
Location: Flintshire, UK
Name: Stuart Jackson
Contact:

Re: Bulk Add Users

Post by Saldash »

phpMyAdmin..

Export phpbb_users table to Excel Spreadsheet
name the phpbb_users table to phpbb_users_backup
Add your new data to the exported spreadsheet table making sure each is under the correct header
Import the XLS file through phpmyAdmin and call it phpbb_users

phpMyAdmin has more comprehensive instructions on how to do this as well.
World Recoded UK - DreamHost Site of the Month winner February 2011!
siddhartha.dash
Registered User
Posts: 1
Joined: Wed Feb 12, 2014 7:15 am

Re: Bulk Add Users

Post by siddhartha.dash »

Hey we have also implemented this and it worked great !
Though it does not send email to the newly added users.

We have also added the mod: acp_add_user-1.1.2
wherein admin can create a user and invitation goes to added user automatically.

Can we do the same this here as well for bulk user upload?

Thanks in advance.
junior52
Registered User
Posts: 10
Joined: Wed Sep 23, 2015 6:15 am

Re: Bulk Add Users

Post by junior52 »

I have created the CSV and php file and uploaded to the root directory. But getting the following errors. any one pls guide me to get it corrected plz.......

steps wise guidance is appreciated.

Code: Select all

SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '7) VALUES ('example', 'example', '$2y$10$jNTAW3sXd4dwWtIijcVnGeAajw0D3hdW4' at line 1 [1064]

SQL

INSERT INTO phpbb_users (username, username_clean, user_password, user_email, user_email_hash, group_id, user_type, user_permissions, user_timezone, user_dateformat, user_lang, user_style, user_actkey, user_ip, user_regdate, user_passchg, user_options, user_new, user_inactive_reason, user_inactive_time, user_lastmark, user_lastvisit, user_lastpost_time, user_lastpage, user_posts, user_colour, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_message_rules, user_full_folder, user_emailtime, user_notify, user_notify_pm, user_notify_type, user_allow_pm, user_allow_viewonline, user_allow_viewemail, user_allow_massemail, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield, user_form_salt, 7) VALUES ('example', '1983.nidhi', '$2y$10$jNTAW3sXd4dwddefdefdfywwrajw0D3hdW4.VfeGyuxGEqweZ3O8iU2', '[email protected],', '134889696521', '2', '0', '', 'Asia/Kolkata', 'd M Y, H:i', 'en', 1, '', '', 1443249161, 1443249161, 230271, 0, 0, 0, 1443249161, 0, 0, '', 0, '', '', '', 0, 0, 0, 0, 0, 0, -3, 0, 0, 1, 0, 1, 1, 1, 1, '', '', '', '5f0ea084da6eb9ad', '0')

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 852
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/includes/functions_user.php
LINE: 275
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/users_add.php
LINE: 96
CALL: user_add()
thanks
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Bulk Add Users

Post by Lumpy Burgertushie »

see this in your code: user_form_salt, 7)

that , 7 shouldn't be there.

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
junior52
Registered User
Posts: 10
Joined: Wed Sep 23, 2015 6:15 am

Re: Bulk Add Users

Post by junior52 »

Lumpy Burgertushie wrote:see this in your code: user_form_salt, 7)

that , 7 shouldn't be there.

robert

Robert Sir, I am sorry to ask you this... can you plz tell me where should i do the changes advised by you? B'coz i am very new to this sir. Do you want me to do the said changes through PhpMyadmin?

thanks for your reply
User avatar
ViolaF
I've Been Banned!
Posts: 1609
Joined: Tue Aug 14, 2012 11:52 pm

Re: Bulk Add Users

Post by ViolaF »

change the csv as mentioned and call it as import via PHPMyAdmin
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Bulk Add Users

Post by Lumpy Burgertushie »

what were you doing when you got this error? whatever file you are trying to run that has that mysql query in it.

the query is wrong where I showed you.

edit whatever file that is .


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
junior52
Registered User
Posts: 10
Joined: Wed Sep 23, 2015 6:15 am

Re: Bulk Add Users

Post by junior52 »

Now I got it. Now success fully added users to my board with a simple modification to my csv file. Actually I forgot to add the username user_password user_email group_id user_lang user_type user_regdate
@ the top of the csv. After corrected and uploaded them to the root directory, now i got the message as below.


ADDING USERS

All the users have been imported correctly!

The following users have been added to the DB:

username, user01, user02, user03, user04, user05, user06, user07

I have checked through my admin CP and everything seems working fine.

Thanks for all the members who were participated and guided me on this thread/topic
Last edited by junior52 on Mon Sep 28, 2015 10:38 am, edited 1 time in total.
Locked

Return to “[3.0.x] MOD Writers Discussion”