1
iolai
How to add a new user directly to database?
  • 2004/7/9 22:20

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


A little introduction.

My site is a site of MUD called DuneMUD (how's that for a sentence?). I want the players to be able to post on the forums that are located on the site. So far so good.

The problem is that I cannot allow direct registration at the site, because people would be able to register under another players' name. In addition, I don't want to register every new player that comes manually, it's too much work, and there will be a big waiting time.

The solution I've found is that when the player logs to the game, he will type a command, and the command will create a new user in XOOPS database.

The problem is that I don't know how to add the user directly to the database. I will be able to handle MySql syntax, but I don't have a slightest idea what tables should be altered and in what way so that the user will be registered properly.

Could anyone help me? I need a detailed help, if possible.

Thank you very much.

2
Mithrandir
Re: How to add a new user directly to database?

Will you have access to anything more than SQL queries?

This ought to work:
INSERT INTO `xoops_users` (unameemailpassVALUES ('$uname''$email''$pass')

for creating the user - how you get the username, email and password and get it into the SQL query, I'll let you find out

Now, the next is a little more tricky as you will need to get the insert id of the just executed query (In XOOPS we use a method, which will execute mysql_insert_id($this->conn);)

Then you should use that insert ID in the following:
INSERT INTO `xoops_groups_users_link` (groupiduidVALUES (2$insertID)

To put the user in the registered users group.

of course, if you have access to call a php page from your game script, it could be somewhat easier.

3
iolai
Re: How to add a new user directly to database?
  • 2004/7/9 22:52

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


Someone mentioned the the password should be encrypted.
In the first line of the code, do I have to encrypt the password, or do I insert it as it is?

4
Mithrandir
Re: How to add a new user directly to database?

oh right - yes, it must be encrypted with the md5 encryption algorithm (it's a standard one-way encryption algoritm, so I hope it is available to you, too - not knowing which programming language you will be able to use)

Edit: I actually think it is available in MySQL
INSERT INTO [...] VALUES ('$uname''$email'md5($pass))

5
anlace
Re: How to add a new user directly to database?
  • 2004/7/27 23:09

  • anlace

  • Just popping in

  • Posts: 43

  • Since: 2004/7/27


Greetings,

Is there a module that can be added to XOOPS that will allow only manually added users? I am working with a client that does not want anyone to create their own account, they need to pay first to access the articles on the site. He is also fairly PC illiterate, he can fill in a form etc just fine, but to have him run scripts or directly access the database . . . . no way!

I'll keep looking for this and post my findings here if that happens outside of this forum.

Peace,
Gail

6
iolai
Re: How to add a new user directly to database?
  • 2004/7/28 21:50

  • iolai

  • Quite a regular

  • Posts: 206

  • Since: 2004/6/26


You can just disable registration of new users, and add new users manually.

7
briandhuff
Re: How to add a new user directly to database?
  • 2004/8/30 5:16

  • briandhuff

  • Just popping in

  • Posts: 2

  • Since: 2004/8/30


I have something similar to this, however, I can NOT run any PHP scriptiong in my case.

Here is the setup:
XOOPS 2.0.7
MySQL 4.0.17
Hosted on a personal server I own in a Datacenter.
Xoops is working 100% Great (love the software!).

Located in an office building, I have a client/server piece of software that I wrote in Delphi 6.0 that runs a member registration system, the database is Access.

I would like to run a nightly batch from the Client/Server program to insert new users into the XOOPS database.

This means I can not run any scripts on the php side of things.

I already have the librarys in place to connect to MySQL etc from my Delphi application so this is done.

If I am correct, I *should* be able to insert name, uname, email, and pass into the [prefix]_users table.

I tried this just from phpmyadmin and of course got an error because of the MD5 encryption on the pass. Looking for a Delphi library for that as we speak. Anyway, is there anything else I need to keep in mind or not here?

Thanks in advance,
Brian

8
briandhuff
Re: How to add a new user directly to database?
  • 2004/8/30 5:44

  • briandhuff

  • Just popping in

  • Posts: 2

  • Since: 2004/8/30


I have found all that I needed, and was able to complete the batch function that I was looking for.

If anyone is interested in how I went about doing it, feel free to email me at briandhuff[at]gmail.com (replace [at] with @]

Brian

Login

Who's Online

480 user(s) are online (51 user(s) are browsing Support Forums)


Members: 0


Guests: 480


more...

Donat-O-Meter

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

Latest GitHub Commits