AKA. Panther
Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922
|
|
Quote:
Originally posted by EDGE
Copy and paste?
|
I have a much better way
PHP Code:
<?
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'On');
ini_set('display_startup_errors', 'On');
include("./phpbb_db.php");
//Function taken from phpBB
function decode_ip($int_ip) {
$hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
}
//;;;;;;;;;;;;;;;;;;;;;;;;;;
// Copy topics and posts from phpbb to vbulletin by Scott L.
//;;;;;;;;;;;;;;;;;;;;;;;;;;
$phpbb_db="phpbb";
$phpbb_forum_id="2";
$vb_db="vb";
$vb_forum_id="280";
//;;;;;;;;;;;;;;;;;;;;;;;;;;
echo "<pre>";
$sql="
SELECT
topic_id,
topic_title,
topic_poster,
topic_time,
topic_views,
topic_replies,
topic_type,
topic_first_post_id,
topic_last_post_id,
forums_users.username
FROM forums_topics
LEFT JOIN forums_users ON forums_users.user_id = topic_poster
WHERE forum_id='".$phpbb_forum_id."'
";
$query=$ph->query($sql);
while($topic=$ph->fetch_array($query)) {
$sql="
SELECT
post_time,
poster_id,
forums_users.username
FROM forums_posts
LEFT JOIN forums_users ON forums_users.user_id = poster_id
WHERE post_id='".$topic['topic_last_post_id']."'
";
$last_post=$ph->result($sql);
If($last_post['username']=="" OR $last_post['username']=="Anonymous") {
$last_post['username']="Guest";
}
If($topic['username']=="" OR $topic['username']=="Anonymous") {
$topic['username']="Guest";
}
$sql="
INSERT INTO ".$vb_db.".thread
(
title,
lastpost,
forumid,
pollid,
open,
replycount,
postusername,
postuserid,
lastposter,
dateline,
views,
iconid,
notes,
visible,
sticky,
votenum,
votetotal,
attach
)
VALUES
(
'".addslashes($topic['topic_title'])."',
'".$last_post['post_time']."',
'".$vb_forum_id."',
'0',
'1',
'".$topic['topic_replies']."',
'".addslashes($topic['username'])."',
'0',
'".addslashes($last_post['username'])."',
'".$topic['topic_time']."',
'".$topic['topic_views']."',
'0',
'',
'1',
'".$topic['topic_type']."',
'0',
'0',
'0'
)
";
echo($sql);
$ph->query($sql);
$last_id=$ph->last_id();
$sql="
SELECT
topic_id,
post_time,
poster_ip,
poster_id,
post_username,
forums_posts_text.post_id,
forums_posts_text.post_subject,
forums_posts_text.post_text
FROM forums_posts
LEFT JOIN forums_posts_text ON forums_posts_text.post_id = forums_posts.post_id
WHERE topic_id='".$topic['topic_id']."'
";
$query2=$ph->query($sql);
while($posts=$ph->fetch_array($query2)) {
If($posts['post_username']=="") {
$sql="
SELECT
username
FROM forums_users
WHERE user_id='".$posts['poster_id']."'
LIMIT 1
";
$temp=$ph->result($sql);
$posts['post_username']=$temp['username'];
}
If($posts['post_username']=="Anonymous") {
$posts['post_username']="Guest";
}
$sql="
INSERT INTO ".$vb_db.".post
(
threadid,
username,
userid,
title,
dateline,
attachmentid,
pagetext,
allowsmilie,
showsignature,
ipaddress,
iconid,
visible,
edituserid,
editdate
)
VALUES
(
'".$last_id."',
'".addslashes($posts['post_username'])."',
'0',
'".addslashes($posts['post_subject'])."',
'".$posts['post_time']."',
'0',
'".addslashes($posts['post_text'])."',
'1',
'1',
'".decode_ip($posts['poster_ip'])."',
'0',
'1',
'0',
'0'
)
";
echo($sql);
$ph->query($sql);
} // posts
} // topics
?>
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Last edited by Scott; 06-22-2007 at 02:46 AM.
|