1
hkfind
Bulk users create
  • 2006/6/5 4:17

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


I have nearly 700 users account want to create. I want to know is there any method I can do it? I am not familiar with the command in mysql.

2
davidthomas1
Re: Bulk users create

Someone wrote a script to import members.

Have a look at this thread:

https://xoops.org/modules/newbb/viewtopic.php?topic_id=49733&forum=27&post_id=219278#forumpost219278
みんなちがってみんないい。

XOOPS 2.0.13.2

3
hkfind
Re: Bulk users create
  • 2006/6/5 8:51

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


I had download import users v1, but I don't know how to use it. Also, in the php file I don't know what is the meaning of $bdd

4
hkfind
Re: Bulk users create
  • 2006/6/5 9:07

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


I tried, but fail.

Begin file import users.csv
Error in database : No database selected
Importation stopped.

5
davidthomas1
Re: Bulk users create

I had a look at the import_users file.

"$bdd" is your database name.

If you set $bdd to your XOOPS database, the database should be selected correctly and the script should work.

good luck!
みんなちがってみんないい。

XOOPS 2.0.13.2

6
khuhner
Re: Bulk users create
  • 2006/6/6 1:33

  • khuhner

  • Quite a regular

  • Posts: 232

  • Since: 2006/1/6 3


Here is a script I modified to upload users in the form:

FirstName, LastName, email, password

Note, that I will be communicating to my users that they need to access the "Lost my Password" link and resent their password to something other than what I generated.

Note you have to change the variables $bdd, $host, $user and $pass in the first section (I made these values into variables from the original script).

Good luck.
Kurt


<?
// christian@frxoops.org - http://www.frxoops.org
// Import users from a csv file into XOOPS 2.0.x
// variables
$bdd"test";
$host"localhost";
$user"root";
$pass"";
$fichier "users.csv"// data file as : first name(pseudo);last name;email;password    
// remove line break on last record

mysql_connect($host,$user,$pass) or die("Unable to connect Database");
mysql_select_db($bdd);

// Open file for read
if (file_exists($fichier))
    
$fp fopen("$fichier""r");
else{ 
// unknown file
    
echo "File not found !<br>Import stopped.";
    exit();
}
echo 
'Begin file import '.$fichier.'<br>';
// import line by line
while (!feof($fp)){
    
$ligne fgets($fp,4096);
    
$liste explode(";",$ligne); // create array 
    
$user $liste[0]; //first field 
    
$name $liste[1]; //second field
    
$email$liste[2];
    
$passmd5($liste[3]);    


    
// Add user in xoops_users table
     
$query "insert into xoops_users  (uname, name, email, pass) VALUES ('$user', '$name','$email','$pass')";

     
     
$resultmysql_query($query);
     
$uid mysql_insert_id();
    
    
//Add user in group : users registered 
    
$numgroup ='2';
     
$query "INSERT INTO xoops_groups_users_link  (groupid, uid) VALUES('$numgroup', '$uid')";
     
$resultmysql_query($query);

     if (
mysql_error()){
      echo 
"Error in database : ".mysql_error();
      echo 
"<br>Importation stoppĂ©e.";
      
fclose($fp);
      exit();
}else{
  echo 
"Record ".$uid." - ".$user." added<br> ";
 }
}

echo 
"<br>Import finished successfully.";

fclose($fp);

7
hkfind
Re: Bulk users create
  • 2006/6/6 2:59

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


Am I set the variables wrong?

// variables
$bdd= "vo_users";
$host= "202.67.215.102";
$user= "hohcs_chfs";
$pass= "XXXXXX";
$fichier = "users.csv"; // data file as : first name(pseudo);last name;email;password
// remove line break on last record

Also, am I setting worng in my csv file?

Username; name; email; password

8
davidthomas1
Re: Bulk users create

Try:

// variables
$bdd"vo_users";
$host"localhost";
$user"hohcs_chfs";
$pass"XXXXXX";


HIH
みんなちがってみんないい。

XOOPS 2.0.13.2

9
hkfind
Re: Bulk users create
  • 2006/6/7 3:20

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


Thank you very much. I sucessfully import user information. However, in my XOOPS 2.0.3 version. The field of login name need to be import also. How can I modify the php file to achieve this.

10
hkfind
Re: Bulk users create
  • 2006/6/7 4:14

  • hkfind

  • Just popping in

  • Posts: 12

  • Since: 2006/2/8 1


I found that although I can sucessfull import user information to the user table of mysql, I can't login while using those login information.

Login

Who's Online

169 user(s) are online (122 user(s) are browsing Support Forums)


Members: 0


Guests: 169


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits