1
RSearcy
Database tables -- insert codes
  • 2006/2/9 0:11

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


I can't seem to figure this out.....

Which file contains the SQL "insert statements" that add data into the database whenever a user registers?

Reason why I'm asking is that I want to add some code into that page, whatever page it is, so the username, password, and email address will be inserted into another table in the same database. (in other words, I'd like the "loginname", "pass", and "email" to be inserted into the xoops_user table in addition to the "login", "password", and "email" fields in another table called pcpin_chat -- both tables are in the same exact database)

Thanks so much in advance!

2
m0nty
Re: Database tables -- insert codes
  • 2006/2/9 0:17

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


you would need to make sure that the other password on the software you use also uses md5 encryption etc..

also which XOOPS version are you talking about?

3
RSearcy
Re: Database tables -- insert codes
  • 2006/2/9 0:28

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


Quote:

m0nty wrote:
you would need to make sure that the other password on the software you use also uses md5 encryption etc..

also which XOOPS version are you talking about?


I'm using XOOPS 2.2.3 and using PCPIN's chat program (located athttp://grtest.robertsearcy.info/xoops/chat -- the test site is a redesign project I'm working on for the webmaster of a TV show fansite)

They did have an XOOPS module, but it's an old module and it wouldn't work, or else I woulda used that instead.

4
m0nty
Re: Database tables -- insert codes
  • 2006/2/9 0:34

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


i dunno pcpin, but to do it would mean that pcpin would have to use md5 encryption for passwords.. you would need to find that out 1st..

as far as the module goes, if you still have it, then it maybe possible to make it work with 2.2.4..

5
RSearcy
Re: Database tables -- insert codes
  • 2006/2/9 18:31

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


Can't seem to get an answer to my question over at PCPIN, however, I looked into the database and it looks like the password is encrypted, but I can't really tell if it's MD5 encryption or not. I know the exact password for the account I was looking at, and in the database, it's a bunch of letters and #s, so it's encrypted.

6
wtravel
Re: Database tables -- insert codes

In the file: kernel/user.php
Look for: function insert(&$user, $force = false)

There you can add the code to create a user in the other table as well.

That leaves the question of whether or not they use the same encryption .

7
Dave_L
Re: Database tables -- insert codes
  • 2006/2/9 20:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


To test whether the password is MD5-encoded, use the query:

SELECT * FROM xxxx WHERE yyyy = MD5('zzzz')

where xxxx = table name, yyyy = password column name, zzzz = cleartext password.

If the password is MD5, the query will return the row as the result.

8
RSearcy
Re: Database tables -- insert codes
  • 2006/2/9 20:58

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


Quote:

Dave_L wrote:
To test whether the password is MD5-encoded, use the query:

SELECT * FROM xxxx WHERE yyyy = MD5('zzzz')

where xxxx = table name, yyyy = password column name, zzzz = cleartext password.

If the password is MD5, the query will return the row as the result.


Thanks so much for that query.

To answer the question you all have been asking..........yes, it's MD5 encrypted (and by the way ya'll were talking about the MD5 encryption, thank God it's MD5 encrypted).

Ok, now, the question is, being that I don't know PHP all that well........what code do I put in to insert this stuff into that other table? lol (if ya have to, just give me the code and tell me where I insert the table name, field, etc. -- I should be able to figure that out lol)

9
wtravel
Re: Database tables -- insert codes

That´s a relief
$sql sprintf("INSERT INTO %s (uname_field, email_field, pass_field) VALUES (%s, %s, %s)"$this->db->prefix('other_table_name'), $this->db->quoteString($uname), $this->db->quoteString($email), $this->db->quoteString($pass));
$result $this->db->query($sql);


Where you will need to change the database name and fieldnames. Add these lines just below the line:

$user->assignVar('uid', $uid);

10
RSearcy
Re: Database tables -- insert codes
  • 2006/2/10 3:12

  • RSearcy

  • Just popping in

  • Posts: 45

  • Since: 2004/3/2 2


I can't seem to find that particular line (the $user->assignVar('uid', $uid); line)

All I see is this......(unless I'm looking in the wrong area):

/**
     * insert a new user in the database
     *
     * @param object $user reference to the {@link XoopsUser} object
     * @param bool $force
     * @return bool FALSE if failed, TRUE if already present and unchanged or successful
     */
    
function insert(&$user$force false)
    {
        if (!
parent::insert($user$force)) {
            return 
false;
        }
        
$profile $user->getProfile();
        
$profile->setVar('profileid'$user->getVar('uid'));

        
// save profile
        
if (!$this->_pHandler->insert($profile$force)) {
            foreach (
$profile->getErrors() as $error) {
                
$user->setErrors($error);
            }
            return 
false;
        }
        return 
true;
    }

    
/**
     * delete a user from the database

Login

Who's Online

123 user(s) are online (69 user(s) are browsing Support Forums)


Members: 0


Guests: 123


more...

Donat-O-Meter

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

Latest GitHub Commits