1
Bender
Looking for a script to create lots of users
  • 2004/9/4 22:27

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10



Does by chance anyone got a script to create a lot of users in a XOOPS database?


I just need a big number of users for testing purposes. My search came up with nothing complete. Closest thing i found is this but it is just the basic info how to create users:

https://xoops.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=22004&forum=22

I saw a similar request i think on dev.xoops.org short time ago but if i remember correctly nothing came up because they went another way later.

Well maybe someone had the need for this already and might have something in the drawer.

(username, email ... are not important. Could be just user001, user002 and so on)

2
dheltzel
Re: Looking for a script to create lots of users
  • 2004/9/5 1:35

  • dheltzel

  • Not too shy to talk

  • Posts: 164

  • Since: 2003/1/8 1


Here's what I've done. I learned a lot about the registration process as a result.

1) Do a MySQL dump to a file (dump1.sql in this ex)
2) Register a single user manually. Approve the user reg in the admin menu.
3) Do another dump (dump2.sql)
4) Diff the 2 dump files (diff dump?.sql > add_user.sql)
5) Edit out any extraneous inserts from the add_user.sql.
6) Use any tool you like to generate a sql file with insert modeled after those in add_user.sql (perl, awk, even bash should do).
7) Run the resulting inserts in you MySQL db.

Dennis

3
Bender
Re: Looking for a script to create lots of users
  • 2004/9/5 1:41

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Well that would be an idea but meaning a lot of editing by hand because i myself can´t write any scriptlanguage.

I was thinking along the lines of a short script with something like

for i=1 to 500
command_to_create_insert($usrname+i, $....)
return

Just to give you an idea. I know that this is no valid code

But thanks for your suggestion. Might still be doing it that way.




From We need users ... lots of users to We need wafers ... lots of wafers
http://www.matrix-xp.com ---> One real good Matrix Parody

.

4
ajaxbr
Re: Looking for a script to create lots of users
  • 2004/9/5 2:25

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


Hey Bender
Would you need valid email addressess, could they all have the same password and do they need to have any other info besides a username, uid and whatever else in mandatory?

5
jmass
Re: Looking for a script to create lots of users
  • 2004/9/5 2:37

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


I just added 200+ users in a couple of hours.

But ajaxbr is right, more specifics are needed.

JMass

6
Bender
Re: Looking for a script to create lots of users
  • 2004/9/5 2:52

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Quote:

ajaxbr wrote:
Hey Bender
Would you need valid email addressess, could they all have the same password and do they need to have any other info besides a username, uid and whatever else in mandatory?


No they only need the minimum info and only have to differ in the name. Everything else can be the same. Don´t care about pw, email ...

Thats why i put in my 'example' $username+1 so if username were 'dummy' the counter would be added and one would end up with dummy1, dummy2 ...

The only purpose is to have a huge amount of users in the database for testing purposes.

7
ajaxbr
Re: Looking for a script to create lots of users
  • 2004/9/5 3:59

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


Fidling with OpenOffice SpreadsheetThingy for about 15 minutes, I was able to build a large SQL file for inserting lots of users.
You can grab it here and you'll need to trim it so that it doesn't overlap with existing UIDs (won't add anything) or it leaves a gap in UIDs (didn't try it ), and of course to the number of members you want .

It has 1312 users and I can make it as big as you want (actually, with as much repetitive info too) without much effort. However, it seems that added users won't be assigned to any existing group so you might need another batch of INSERTs to solve that. Test it and report back, we may end up with a "add lots and lots of users to stress test your server" pack

Edit: oops, they all have 2 posts (sneaky bastards!)

8
ajaxbr
Re: Looking for a script to create lots of users
  • 2004/9/5 4:30

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


A crude script to create more users would be something like
$uidmin 1313;
$uidmax 1316;

for (
$uid $uidmin$uid $uidmax$uid++)
{echo 
"INSERT INTO `xoops_users` VALUES (".$uid.", '', 'JoeUser".$uid."', 'anymail".$uid."@nowhere.com', '', 'blank.gif', 1094155383, '', '', '', 0, '6cc7a5d0', '', '', '', '3516064db5fa1c4c13cd0eee42cce334', 2, 0, 0, 1, '', '0.0', 1094155547, 'nest', 0, 1, 0, '', '', '', 1); ";
}
?>
So that you can set what UIDs are to be generated... if you want to have anything else changing, either incrementally or randomly, it'd be a matter of identifying the right field above and making it another variable with whatever behaviour is necessary. This crude example generated SQL that was as good as my previous method, but I have no idea about how long it'd take to generate lots of entries.

9
Bender
Re: Looking for a script to create lots of users
  • 2004/9/5 23:35

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Hi ajaxbr,

it works great. I modified the script to take care of putting the new users into the usergroups.

Thanks for your help.

(Between what is the password those users have?)

$uidmin 2;          //first userid to be created (check your db table xoops_users to see which is the last used one)
$uidmax 400;        //last userid to be created
$linkidused 7;      //check xoops_groups_users_link which is the last used linkid and enter it here.
$groupid 2;         //check the table xoops_groups to see which $groupid stands for which group. '2' for example is 'registered users' usually

for ($uid $uidmin$uid $uidmax$uid++)
{
  
$result $linkidused $uid
  echo 
"INSERT INTO `xoops_stresstest____users` VALUES (".$uid.", '', 'JoeUser".$uid."', 'anymail".$uid."@fdsflksj.cdb', '', 'blank.gif', 1094155383, '', '', '', 0, '6cc7a5d0', '', '', '', '3516064db5fa1c4c13cd0eee42cce334', 2, 0, 0, 1, '', '0.0', 1094155547, 'nest', 0, 1, 0, '', '', '', 1); ";
  echo 
"INSERT INTO `xoops_stresstest____groups_users_link` VALUES ($result$groupid$uid); ";
}
?>


10
ajaxbr
Re: Looking for a script to create lots of users
  • 2004/9/6 0:56

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


Quote:

Bender wrote:
Hi ajaxbr,

it works great. I modified the script to take care of putting the new users into the usergroups.

Thanks for your help.

(Between what is the password those users have?)
Great, I wish you luck with your stress tests. I'll try to find that password and post it here

Edit: JoeUser's password is "huhuhu567jajaja"

Login

Who's Online

362 user(s) are online (325 user(s) are browsing Support Forums)


Members: 0


Guests: 362


more...

Donat-O-Meter

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

Latest GitHub Commits