FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Question About Adding Users From A Mailing List
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Question About Adding Users From A Mailing List [message #34829] Mon, 20 November 2006 08:58 Go to next message
appscontent   United States
Messages: 33
Registered: November 2006
Karma: 0
Member
add to buddy list
ignore all messages by this user
I admit this is more a question of how to code in PHP ...

I have an extract file in Excel format that contains the following 4 columns of user data:

1. user_name
2. real_name
3. email_address
4. user_password

I have been playing with some of the code that others have posted in the various forums here and found some code call "user.php". I can run this code from the command line as follows, and it successfully adds a single user for me:

bash-2.05a$ php -q user.php create user_name "real_name" mail_address 'user_password'

Question: How can I run this from the command line to read and loop through my extract file to add all my user?

I know that fudapi.inc.php has a function call "fud_add_user" that I probably should be using, but I am not a PHP coder so I could probably on get as far as below if I had to build from scratch:

<?php
include ("fudapi.inc.php");
$ret = fud_add_user();
?

[Updated on: Mon, 20 November 2006 08:58]

Report message to a moderator

Re: Question About Adding Users From A Mailing List [message #34836 is a reply to message #34829] Mon, 20 November 2006 14:10 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
You can save your Excel file in CSV format and then use PHP's fgetcsv() function to fetch users one at a time and for each user perform the import operation.

FUDforum Core Developer
Re: Question About Adding Users From A Mailing List [message #34866 is a reply to message #34829] Tue, 21 November 2006 07:53 Go to previous messageGo to next message
1harsh789 is currently offline  1harsh789   India
Messages: 4
Registered: September 2006
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
You can also use mysql "LOAD DATA INFILE" to directly load data from your csv file into table.

for ex.

LOAD DATA INFILE 'data.txt' INTO TABLE user
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n';




Re: Question About Adding Users From A Mailing List [message #34868 is a reply to message #34866] Tue, 21 November 2006 10:12 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
That would not work because you need to insert passwords as md5 hashes and you need to populate few additional fields in the users table beyond the login/name/password/email

FUDforum Core Developer
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Just a few things
Next Topic: Failure in db.inc line 16
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Dec 14 21:47:48 EST 2017

Total time taken to generate the page: 0.00804 seconds