PDA

View Full Version : Wbb to VB, half way done


pawel
01-03-2003, 07:06 PM
Hi,
I am almost done writing a wbb to VB converter but I ran into some trouble. First, when you post a new thread, register, or reply it gives you a database error but it performs the action. Second, all the users appear as guests but I think that's because I didn't add them to the activation table. For now those are the 2 biggest problems. Here is the script:

<?

mysql_connect("localhost", "xxx", "xxx");
$db_wbb = xxx;

mysql_select_db("$db_wbb")
or die("Could not select database");
print "Connected successfully<br><br>impoting...<br>";

//$result = mysql_query("SELECT userid, groupid, username, userpassword, useremail, userhp, usericq, aim, yim, signatur, statusextra, regdate, posts FROM bb1_user_table");

// User Import

$result = mysql_query("SELECT userid, groupid, username, userpassword, useremail, userhp, usericq, aim, yim, signatur, statusextra, regdate, userposts FROM bb1_user_table");


while ($row = mysql_fetch_array($result))
{
$password = $row["userpassword"];

$usergroup = $row["groupid"];

if($usergroup == 1) // admin
{
$usergroup = 6;
}
else if($usergroup == 3) // std user
{
$usergroup = 2;
}
else if($usergroup == 2) // Moderator
{
$usergroup = 7;
}


else {
$usergroup = 3;
}

$userid = $row["userid"];

if($userid == 1)
{
$userid = 2;
}

$username = $row["username"];
$email = $row["useremail"];
$posts = $row["posts"];
$joindate = $row["regdate"];
$lastvisit = $row["lastvisit"];
$lastactivity = $row["lastactivity"];
$signature = $row["signatur"];
$icq = $row["usericq"];
$aim = $row["aim"];
$yim = $row["yim"];
$homepage = $row["userhp"];
$usertitle = $row["usertitle"];

//stucture
//$result = mysql_query("SELECT userid, usergroupid, username, password, email, homepage, icq, aim, yahoo, signature, usertitle, joindate, posts FROM user");


// mysql_query("INSERT into bb1_user_table VALUES ('$userid', '$username', '$password', '$email', '$email', '$posts', '$usergroup', '', '$joindate', '$lastvisit', '$lastactivity', '1', '$signature', '$icq', '$aim', '$yim', '$homepage', '', '0', '0', '0', '', '', '$usertitle', '0', '', '0', '1', '1', '0', '0', '0', '0', '0', '1', '0', '1', '0')");
//mysql_query("INSERT into user VALUES ('$userid', '$username', '$password', '$email', '$email', '$posts', '$usergroup', '', '$joindate', '$lastvisit', '$lastactivity', '1', '$signature', '$icq', '$aim', '$yim', '$homepage', '', '0', '0', '0', '', '', '$usertitle', '0', '', '0', '1', '1', '0', '0', '0', '0', '0', '1', '0', '1', '0')");


mysql_query("INSERT into user VALUES ('$userid', '$usergroup', '$username' ,'$password', '$email', '1', '', '0', '$homepage', '$icq', '$aim', ' $yim', '$signature', '1', '1', '0', 'User', '0', '$joindate', '1', '-1', '$lastvisit', '$lastactivity', '', '$posts', '0', '0', '', '', '', '1', '1', '1', '1', '15', '0000-00-00', '-1', '1', '', '0', '0', '0')");
}
echo "imported users";


//Import Boards


$result = mysql_query("SELECT boardid, boardparentid, boardname, boardpassword, descriptiontext, threads, posts, lastposttime, lastpostid, sort, isboard, invisible, style_set FROM bb1_boards");


while ($row = mysql_fetch_array($result))
{

$boardid = $row["boardid"];
$boardparentid = $row["boardparentid"];
$boardname = $row["boardname"];
$boardpassword = $row["boardpassword"];
$descriptiontext = $row["descriptiontext"];
$threads = $row["threads"];
$posts = $row["posts"];
$lastposttime = $row["lastposttime"];
$lastpostid = $row["lastpostid"];
$sort = $row["sort"];
$isboard = $row["isboard"];
$invisible = $row["invisible"];
$homepage = $row["style_set"];

if ($isboard == 0) {
$allowposting = 0;
$cancontainthreads = 0;
$daysprune = 0;

}
else {
$allowposting = 1;
$cancontainthreads = 1;
$daysprune = 1;
}

if ($boardparentid == 0) {
$boardparentid1 = -1;
}

else {
$boardparentid1 = $row["boardparentid"];
}


echo "importing $boardname";
mysql_query("INSERT into forum VALUES ('$boardid', '1', '$boardname' ,'$descriptiontext', '1', '1', '$posts', '$lastposttime', 'unknown', '$threads', '$allowposting', '$cancontainthreads', '$daysprune', '', '', '0', '0', '1', '1', '0', '1', '1', '$boardparentid1', '', '1', '1', '0')");
echo "...done <br>";
}
echo "imported boards";


//import threads
$result = mysql_query("SELECT boardparentid, starttime, threadid, threadname, authorid, author, lastposterid, replies, views, timelastreply, important FROM bb1_threads");


while ($row = mysql_fetch_array($result))
{

$boardparentid = $row["boardparentid"];
$starttime = $row["starttime"];
$threadid = $row["threadid"];
$threadname = $row["threadname"];
$authorid = $row["authorid"];
$author = $row["author"];
$lastposterid = $row["lastposterid"];
$replies = $row["replies"];
$views = $row["views"];
$timelastreply = $row["timelastreply"];
$important = $row["important"];



echo "importing $threadname";
mysql_query("INSERT into thread VALUES ('$threadid',
'$threadname',
'$timelastreply',
'$boardparentid',
'0',
'1',
'$replies',
'$author',
'$authorid',
'unknown',
'$starttime',
'$views',
'0',
'',
'1',
'$important',
'0',
'0',
'0')")
or die(mysql_error());


echo "...done <br>";
}
echo "<b>imported threads</b>";


//import posts
$result = mysql_query("SELECT boardparentid, threadparentid, postid, userid, posttime, edittime, editorid, posttopic, message, posticon, ip FROM bb1_posts");


while ($row = mysql_fetch_array($result))
{

$boardparentid = $row["boardparentid"];
$threadparentid = $row["threadparentid"];
$postid = $row["postid"];
$userid = $row["userid"];
$posttime = $row["posttime"];
$edittime = $row["edittime"];
$editorid = $row["editorid"];
$posttopic = $row["posttopic"];
$message = $row["message"];
$posticon = $row["posticon"];
$ip = $row["ip"];

$result1 = mysql_query("SELECT username FROM bb1_user_table WHERE userid='$userid'");

while ($row1 = mysql_fetch_array($result1))
{

$username = $row1["username"];
}

echo "importing $posttopic";
mysql_query("INSERT into post VALUES ('$postid',
'$threadparentid',
'$username',
'$userid',
'$posttopic',
'$posttime',
'',
'$message',
'1',
'1',
'$ip',
'0',
'1',
'$editorid',
'$edittime')")
or die(mysql_error());


echo "...done <br>";
}
echo "<b>imported Posts</b>";

mysql_close();
?>

Any help would be appreciated.
Thank You,
Paul

pawel
01-03-2003, 09:42 PM
Somebody please help. If I don't get this done I will lose over 5,500 posts.
Thanks,
Paul

NTLDR
01-03-2003, 09:50 PM
There no need to bump threads just because nobody as responeded in a few hours.

pawel
01-03-2003, 09:57 PM
I know, I'm sorry, I'm becoming desperate. I will pay someone $50 to fix the above script.
Thank You,
Paul

pawel
05-23-2003, 02:51 PM
I just remembered this post. If anyone needs this I got it working. The code is still a little messy so I will have to clean it up a bit, let me know if anyone is interested in it.
Paul

Morpheus84
07-05-2003, 12:33 PM
Is it an wBB 2.1 to vBulletin Converter ?

And if its, is it an wbb 2.0.x to vb3 or wbb 2.1 to vb 2.3.0 converter ?