1
acris
hack for creating a list of users
  • 2005/11/9 12:07

  • acris

  • Just popping in

  • Posts: 20

  • Since: 2005/10/31


It seams strange, but I need to create a list of users for an special group. The users must be anonimous because they will participate in one scientific experiment.
We will distribute logins and passwords to previously instructed informants.
Then, I need to create a list of hundreds of users, calleds "n" (from 1 to x), with non real e-mails (n@mysite.org).
In the admin area of XOOPS I must to create that one by one. I think it could be done using a hack, but I didn't find the solution yet.
I'll keep trying, but I would apreciate if someone could help me with this hack. I'm not a programer, but I have a little knowledge about programing.
Thanks
Acris

2
davidthomas1
Re: hack for creating a list of users

You could do it if you made a PHP script to insert the data directly into the xoops_user table.

You'd have to know a bit of PHP and SQL to do that. good practice though.

As always, backup your database before making any changes to it.

You'd need to loop through the SQL INSERT statement changing certain fields (e.g incrementing the email address name)

You could use an existing users encrypted password from the DB field for the SQL statement (the dummy users would all then have the same password)

it's a little tricky, but it could be done.

a mysterious experiment!
みんなちがってみんないい。

XOOPS 2.0.13.2

3
christian
Re: hack for creating a list of users
  • 2005/11/9 12:38

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


Hi,

You can adapt this script .
If need be I will be able to help you.

Best regards

4
acris
Re: hack for creating a list of users
  • 2005/11/10 0:00

  • acris

  • Just popping in

  • Posts: 20

  • Since: 2005/10/31


Thanks, guys, both of your answers was very helpful.
I adapted the Christian’s script and made the hack above.
There was just one problem that I could not solve: the automatic creation of different passwords. I was trying to make them using a variable concatenation of one fixed word and the number of the user. But, because XOOPS password is crypto graphed (as you said, davidthomas1), the password created did not work. I used, then, a fixed password for making the lista, with the word “teste” that will be the same for every user, just copying its code from the MySQL table, as it appears in the script (again, as you said, davidthomas1).
If someone know a more elegant way of doing that, I will appreciate your collaboration.
Thanks again,
Acris

Quote:

<?php
error_reporting(E_ALL);
// creating a list of anonimous users; author Ana Matte (acrishttp://www.xoops.net.br)
// adapted from christian@frxoops.org -http://www.frxoops.org:
// for XOOPS 2.0.x
// I recieved some help from friends of the www.xoops.net.br: Desus, Diego and Hostmarx. Thanks!

$bdd= "testephp";
$host= "localhost";
$user= "ana";
$psw= "";

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

// Add user in xoops_users table
$n = 1;
for ($n = 35; $n < 36; $n++){
$uname = "{$n}";
$pass = "698dc19d489c4e4db73e28a713eab07b";
$email = "{$uname}\@semiofon.org";
$query = "insert into teste_users (uname, name, email, pass) VALUES ('$uname', '$uname', '$email','$pass')";
$result= mysql_query($query);
$uid = mysql_insert_id();

//Add user in group : experimento
$numgroup ='5';
$query = "INSERT INTO teste_groups_users_link (groupid, uid) VALUES('$numgroup', '$uid')";
$result= mysql_query($query);
}

if (mysql_error()){
echo "Error in database : ".mysql_error();
echo "<br>users' creation interrupted.";
exit();
}else{
echo "Record ".$uid." - ".$uname." added<br> ";
}

echo "<br>Creation of users finished successfully."
?>

5
davidthomas1
Re: hack for creating a list of users

If you could find the hash function (MD5??) that XOOPS uses for encrypting passwords, you could probably add it to the custom script to encrypt your password too.
みんなちがってみんないい。

XOOPS 2.0.13.2

6
acris
Re: hack for creating a list of users
  • 2005/11/11 9:06

  • acris

  • Just popping in

  • Posts: 20

  • Since: 2005/10/31


Yes, my friend, you are right.
I found this in the php.net website, in the manual.
I created a protocol for creatind passwords for my site not so obvious as the number of the users and I'll use the MD5 to convert that into cryptographed codes.
Very good.
Thank you.
Acris

Login

Who's Online

230 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 230


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