PDA

View Full Version : Qurrie Challenge...


RichieBoy67
04-13-2005, 11:33 PM
OK, we are trying to import new members from an existing pages membersign on page to a vb database...


Right now there is the following

// VBulletin account creation
$PasswordDate = date("Y-m-d");
$JoinDate = time();
OpenDB("INSERT INTO vb_user
(usergroupid, username, password, passworddate, email, usertitle, joindate, showvbcode)
VALUES
(2,'$Username',md5(md5('$Password')),'$PasswordDat e','$Email','Junior Member',$JoinDate,2)");

// save user count and new user id to template

// get total members
$result = OpenDB("SELECT COUNT(*) AS users, MAX(userid) AS max FROM vb_user");
$row = mysql_fetch_assoc($result);

$members = $row['users'];
$maxmembers = $row['max'];

$result = OpenDB("SELECT userid, username FROM vb_user WHERE userid = $maxmembers");
$row = mysql_fetch_assoc($result);

$newestusername = $row['username'];
$newuserid = $row['userid'];

// make a little array with the data
$values = array(
'numbermembers' => $members,
'newusername' => $newestusername,
'newuserid' => $newuserid
);

OpenDB("REPLACE INTO vb_datastore (title, data) VALUES ('userstats', '" . serialize($values) . "')");



// End VBulletin account creation
/* ----------------------------------- */


This seems to work somehwhat but new registrants end up being only guests. My guess is that there needs to be another querrie sending user info into the usergroup table??? Am I on the right track here???

By the way--- This current script makes the new registrants guests but to fix all that needs to be done is counter updating....

I would really, really appreciate any input on this,

Thanks so much,

Rich

Zachery
04-14-2005, 12:46 AM
OK, we are trying to import new members from an existing pages membersign on page to a vb database...


Right now there is the following

// VBulletin account creation
$PasswordDate = date("Y-m-d");
$JoinDate = time();
OpenDB("INSERT INTO vb_user
(usergroupid, username, password, passworddate, email, usertitle, joindate, showvbcode)
VALUES
(2,'$Username',md5(md5('$Password')),'$PasswordDat e','$Email','Junior Member',$JoinDate,2)");

// save user count and new user id to template

// get total members
$result = OpenDB("SELECT COUNT(*) AS users, MAX(userid) AS max FROM vb_user");
$row = mysql_fetch_assoc($result);

$members = $row['users'];
$maxmembers = $row['max'];

$result = OpenDB("SELECT userid, username FROM vb_user WHERE userid = $maxmembers");
$row = mysql_fetch_assoc($result);

$newestusername = $row['username'];
$newuserid = $row['userid'];

// make a little array with the data
$values = array(
'numbermembers' => $members,
'newusername' => $newestusername,
'newuserid' => $newuserid
);

OpenDB("REPLACE INTO vb_datastore (title, data) VALUES ('userstats', '" . serialize($values) . "')");



// End VBulletin account creation
/* ----------------------------------- */


This seems to work somehwhat but new registrants end up being only guests. My guess is that there needs to be another querrie sending user info into the usergroup table??? Am I on the right track here???

By the way--- This current script makes the new registrants guests but to fix all that needs to be done is counter updating....

I would really, really appreciate any input on this,

Thanks so much,

Rich
Are you upading the other tables? there are at LEAST 3 tables you need to insert new data into.

RichieBoy67
04-14-2005, 01:17 AM
Could you please eloborate??? Members will not be registering through VBs registration page--just the sites main page... That is why I didn't think the other tables were needed......

Zachary.... Isn't there a hack somewhere that adds you to credits or something???? I am going to have to install that. You have helped me so many times!!!

Thanks!!

tnguy3n
04-14-2005, 01:49 AM
I think you need to insert into passwordhistory + session table.

RichieBoy67
04-14-2005, 02:00 AM
wow- I am way off on this one I guess.....

It seemed that everything worked fine after updating counters.... I thought it was just a usergroup querrie that was needed similiar to the querrie added to the user table....

Link14716
04-14-2005, 03:25 AM
Could you please eloborate??? Members will not be registering through VBs registration page--just the sites main page... That is why I didn't think the other tables were needed......

Zachary.... Isn't there a hack somewhere that adds you to credits or something???? I am going to have to install that. You have helped me so many times!!!


Thanks!!
Those other tables are needed since vB always assumes the row will be there.

RichieBoy67
04-14-2005, 11:12 AM
That makes sense....

Could I bother you to be more specific though and tell me which querries etc are needed????? I am very confused with all of this....

So I guess I was at least on the right track. A querrie does have to be added to usergroups but what other tables???? userfields??

Thanks

Zachery
04-14-2005, 03:05 PM
user
userfield
usertextfield

I think.

RichieBoy67
04-14-2005, 03:45 PM
Thanks Zachary!!

Closer than I was but still having a hard time with this.... Tough one I guess...

By any chance.... did you see my post on the other site???? Maybe you can help me there...... Should be an easy one for you.....

I'm adding you to credits tonight by the way.... you deserve it Zachary... seriously man.. I am not just kissing but... you really have helped me so many dam times...... I appreciate it man.. Thanks