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 :: Polls :: Message Navigator
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 13:58 Go to next message
appscontent   United States
Messages: 33
Registered: November 2006
Karma: 0
Member
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 13: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 19: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
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 12:53 Go to previous messageGo to next message
1harsh789 is currently offline  1harsh789   India
Messages: 4
Registered: September 2006
Karma: 0
Junior Member
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 15:12 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
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
  Switch to threaded view of this topic Create a new topic Submit Reply
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 Nov 28 17:11:13 GMT 2024

Total time taken to generate the page: 0.02136 seconds