PDA

View Full Version : How to add user into the VB Forum using SQL Statement?


nnjj.net
09-14-2004, 11:38 AM
Hi,


I want to add big bulk of users into the VB Forum. I've tried to add one using this query:

Insert Into vbdatabase.user
(usergroupid, membergroupids, displaygroupid, username, password, passworddate,
email, styleid, parentemail, homepage, icq, aim, yahoo, showvbcode, usertitle,
customtitle, joindate, daysprune, lastvisit, lastactivity, lastpost, posts, reputation,
reputationlevelid, timezoneoffset, pmpopup, avatarid, avatarrevision, options,
birthday, birthday_search, maxposts, startofweek, ipaddress, referrerid, languageid,
msn, emailstamp, threadedmode, autosubscribe, pmtotal, pmunread, salt) values
(3, '', 0, 'bukharia', '', '2004-09-12',
'bukhari00@yahoo.com', 1, '', '', '', '', '', 1,
'Junior Member', 0, 1094990400, 0, 1094996400,
1094996400, 0, 0, 10, 5, 3, 0, 0, 0, 7255, '',
'0000-00-00', -0, 1, '', 0, 0, '', 0, 0, -1, 0, 0, '<%Z')

The user is added successfully, and I logged in using the new created User ID with no password. The issue is that the User ID is not working correctly.

Kindly provide me with the steps that I can add new users using SQL statements, either in the database directly or from a PHP script.

Thanks & Regards,

Colin F
09-14-2004, 12:38 PM
You'll have to add some other things like a new row in the userfield table.
I can't tell you what else, as I'm at work atm.

nnjj.net
09-15-2004, 05:24 AM
any update?

miz
09-15-2004, 06:12 PM
i also tried it

Insert Into vbdatabase.user
(usergroupid, membergroupids, displaygroupid, username, password, passworddate,
email, styleid, parentemail, homepage, icq, aim, yahoo, showvbcode, usertitle,
customtitle, joindate, daysprune, lastvisit, lastactivity, lastpost, posts, reputation,
reputationlevelid, timezoneoffset, pmpopup, avatarid, avatarrevision, options,
birthday, birthday_search, maxposts, startofweek, ipaddress, referrerid, languageid,
msn, emailstamp, threadedmode, autosubscribe, pmtotal, pmunread, salt) values
(3, '', 0, 'bukharia', '', '2004-09-12',
'bukhari00@yahoo.com', 1, '', '', '', '', '', 1,
'Junior Member', 0, 1094990400, 0, 1094996400,
1094996400, 0, 0, 10, 5, 3, 0, 0, 0, 7255, '',
'0000-00-00', -0, 1, '', 0, 0, '', 0, 0, -1, 0, 0, '<%Z')

and also added this line after

$newuserid = $DB_site->insert_id();

and when this didnt worked i added :
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user
SET userid = '$id'
WHERE username = 'bukharia'
");

but didnt worked as well
any idea's ?

Colin F
09-15-2004, 06:25 PM
the insert_id() should return the id you inserted....

You'll have to add userfield, usertextfield as well...

miz
09-15-2004, 06:32 PM
the insert_id() should return the id you inserted....

You'll have to add userfield, usertextfield as well...


but they got deafult value's
that if you not add them its sets them alone

for exsample

styleid deafult=0

so if you not add it on the query

mysql set it alone
i also did view (on phpmyadmin)
and they colmuns you said got the deafult value..

so are u sure about what you saying?

edit ::

never mind i got you worng
needed to read few times to understand what you wanted

Colin F
09-15-2004, 06:43 PM
I don't quiite understand your question...

you'll have to set up the fields, even if they are empty.

Also, look in the register.php for what queries are used there.

miz
09-15-2004, 06:47 PM
ok i tested it and its works hmm nnjj.net here is your answer :


after
Insert Into vbdatabase.user
(usergroupid, membergroupids, displaygroupid, username, password, passworddate,
email, styleid, parentemail, homepage, icq, aim, yahoo, showvbcode, usertitle,
customtitle, joindate, daysprune, lastvisit, lastactivity, lastpost, posts, reputation,
reputationlevelid, timezoneoffset, pmpopup, avatarid, avatarrevision, options,
birthday, birthday_search, maxposts, startofweek, ipaddress, referrerid, languageid,
msn, emailstamp, threadedmode, autosubscribe, pmtotal, pmunread, salt) values
(3, '', 0, 'bukharia', '', '2004-09-12',
'bukhari00@yahoo.com', 1, '', '', '', '', '', 1,
'Junior Member', 0, 1094990400, 0, 1094996400,
1094996400, 0, 0, 10, 5, 3, 0, 0, 0, 7255, '',
'0000-00-00', -0, 1, '', 0, 0, '', 0, 0, -1, 0, 0, '<%Z')

add :

$newuserid = $DB_site->insert_id();

$DB_site->query("INSERT INTO " . TABLE_PREFIX . "usertextfield (userid)VALUES ('$newuserid') ");
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "userfield (userid)VALUES ('$newuserid') ");



and its should work (working for me)

btw how the salt system working ? do you know colin ?

im doing same thing only from other php page
so i need to answer correct password
and im sure its not md5(password);

any idea ?

Colin F
09-15-2004, 06:56 PM
IIRC, its

md5(md5($password).$salt)