bkbelew
01-31-2007, 08:50 PM
I have seen a few people trying to do this, but haven't seen any code to do it successfully. I built a cms, i'm trying to make it where when a user is added they are automatically added to the vbulletin database. No matter what I try I cannot get it to work. Any ideas anyone?
I tried asking on Vbulletin.com but got redirected here.
Thank you
Code:
require('inc/admins/forumconnect.php');
$saltlength = 3;
$salt = '';
for ($i = 0; $i < $saltlength; $i++)
$salt .= chr(rand(32, 126));
$pass = md5(md5($password) . $salt);
$date = strtotime("now");
$forumquery = mysql_query("INSERT INTO user ( username, password, email, usergroupid, options, passworddate, salt )
VALUES('$username','$pass','$email','2','7','$date ','$salt')");
// Get userid
$clientquery = mysql_query("SELECT * FROM user WHERE username = '$username' ");
while ($client = mysql_fetch_array($client_query)) {
// Insert the users userid into the userfield table
$userfield = mysql_query("INSERT INTO userfield ( userid, field1 )
VALUES('$client[userid]','NULL')");
// Insert the users userid into the usertextfield table
$usertextfield = mysql_query("INSERT INTO usertextfield ( userid, subfolders, pmfolders, buddylist, ignorelist, signature, searchprefs )
VALUES('$client[userid]','NULL','NULL','NULL','NULL','NULL','NULL')");
}
I tried asking on Vbulletin.com but got redirected here.
Thank you
Code:
require('inc/admins/forumconnect.php');
$saltlength = 3;
$salt = '';
for ($i = 0; $i < $saltlength; $i++)
$salt .= chr(rand(32, 126));
$pass = md5(md5($password) . $salt);
$date = strtotime("now");
$forumquery = mysql_query("INSERT INTO user ( username, password, email, usergroupid, options, passworddate, salt )
VALUES('$username','$pass','$email','2','7','$date ','$salt')");
// Get userid
$clientquery = mysql_query("SELECT * FROM user WHERE username = '$username' ");
while ($client = mysql_fetch_array($client_query)) {
// Insert the users userid into the userfield table
$userfield = mysql_query("INSERT INTO userfield ( userid, field1 )
VALUES('$client[userid]','NULL')");
// Insert the users userid into the usertextfield table
$usertextfield = mysql_query("INSERT INTO usertextfield ( userid, subfolders, pmfolders, buddylist, ignorelist, signature, searchprefs )
VALUES('$client[userid]','NULL','NULL','NULL','NULL','NULL','NULL')");
}