Since we're intimate with this stuff, perhaps its about time we spent on importer scripts. I'd hate to say it, but we go down this path, we're going to be doing a lot more work than we intended for.
_________________ Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
chatserv General
Joined: Jan 12, 2003
Posts: 3128
Location: Puerto Rico
Posted:
Thu Aug 07, 2003 9:26 am
Have checked the script being offered at that link, the site requires registration to download it and the forums are separate and require another registration, ok so the script seems to be having problems returning dates and one has to manually enter the database login info which can be worked around since the script sits in Nuke's main directory, here's my proposal, anyone willing to test it should make a backup first although from what i have seen the script requires that your Nuke install be a new one where the forums have no data entered yet, so try at your own discretion:
Code:
<?php
/****************************************************************
* phpBB2 to BB2Nuke (c) 2003 Andareed
* Fixed June 2003 UKForums - http://www.ruleit.co.uk/nuke
*
* This converter is released under the GNU GPL license
*
* You will need to manually edit/update your config table
****************************************************************/
//connect to db's
$p_con=mysql_connect($p_host,$p_user,$p_pass);
$n_con=mysql_connect($n_host,$n_user,$n_pass);
// DO NOT MODIFY ANYTHING BELOW !!!
error_reporting(E_ALL);
// DELETE OLD TABLE DATA
mysql_select_db($n_db,$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbauth_access",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbbanlist",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbcategories",$n_con) or mysql_error();
//mysql_query("DELETE FROM {$n_prefix}_bbconfig",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbdisallow",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbforum_prune",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbforums",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbgroups",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbposts",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbposts_text",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbprivmsgs",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbprivmsgs_text",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbranks",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbsearch_results",$n_con) or mysql_error();
//mysql_query("DELETE FROM {$n_prefix}_bbsearch_wordlist",$n_con) or mysql_error();
//mysql_query("DELETE FROM {$n_prefix}_bbsearch_wordmatch",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbsessions",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbsmilies",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbthemes",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbthemes_name",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbtopics",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbtopics_watch",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbuser_group",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_users",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbvote_desc",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbvote_results",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbvote_voters",$n_con) or mysql_error();
mysql_query("DELETE FROM {$n_prefix}_bbwords",$n_con) or mysql_error();
// START EXPORTING/IMPORTING
global $row,$result,$count;
mysql_select_db($p_db,$p_con);
// phpbb_auth_access
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_auth_access",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbauth_access SET
group_id='{$row['group_id']}',
forum_id='{$row['forum_id']}',
auth_view='{$row['auth_view']}',
auth_read='{$row['auth_read']}',
auth_post='{$row['auth_post']}',
auth_reply='{$row['auth_reply']}',
auth_edit='{$row['auth_edit']}',
auth_delete='{$row['auth_delete']}',
auth_sticky='{$row['auth_sticky']}',
auth_announce='{$row['auth_announce']}',
auth_vote='{$row['auth_vote']}',
auth_pollcreate='{$row['auth_pollcreate']}',
auth_attachments='{$row['auth_attachments']}',
auth_mod='{$row['auth_mod']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_banlist
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_banlist",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_banlist SET
ban_id='{$row['ban_id']}',
ban_userid='{$row['ban_userid']}',
ban_ip='{$row['ban_ip']}',
ban_email='{$row['ban_email']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_categories
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_categories",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbcategories SET
cat_id='{$row['cat_id']}',
cat_title='{$row['cat_title']}',
cat_order='{$row['cat_order']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_config
/*mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_config",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbconfig SET
config_name='{$row['config_name']}',
config_value='{$row['config_value']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);*/
// phpbb_disallow
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_disallow",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbdisallow SET
disallow_id='{$row['disallow_id']}',
disallow_username='{$row['disallow_username']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_forum_prune
// FIXED BY UKFORUMS
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_forum_prune",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbforum_prune SET
prune_id='{$row['prune_id']}',
forum_id='{$row['forum_id']}',
prune_days='{$row['prune_days']}',
prune_freq='{$row['prune_freq']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_forums
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_forums",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbforums SET
forum_id='{$row['forum_id']}',
cat_id='{$row['cat_id']}',
forum_name='{$row['forum_name']}',
forum_desc='{$row['forum_desc']}',
forum_status='{$row['forum_status']}',
forum_order='{$row['forum_order']}',
forum_posts='{$row['forum_posts']}',
forum_topics='{$row['forum_topics']}',
forum_last_post_id='{$row['forum_last_post_id']}',
prune_next='{$row['prune_next']}',
prune_enable='{$row['prune_enable']}',
auth_view='{$row['auth_view']}',
auth_read='{$row['auth_read']}',
auth_post='{$row['auth_post']}',
auth_reply='{$row['auth_reply']}',
auth_edit='{$row['auth_edit']}',
auth_delete='{$row['auth_delete']}',
auth_sticky='{$row['auth_sticky']}',
auth_announce='{$row['auth_announce']}',
auth_vote='{$row['auth_vote']}',
auth_pollcreate ='{$row['auth_pollcreate']}',
auth_attachments ='{$row['auth_attachments']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_groups
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_groups",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbgroups SET
group_id='{$row['group_id']}',
group_type='{$row['group_type']}',
group_name='{$row['group_name']}',
group_description='{$row['group_description']}',
group_moderator='{$row['group_moderator']}',
group_single_user='{$row['group_single_user']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_posts
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_posts",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbposts SET
post_id='{$row['post_id']}',
topic_id='{$row['topic_id']}',
forum_id='{$row['forum_id']}',
poster_id='{$row['poster_id']}',
post_time='{$row['post_time']}',
poster_ip='{$row['poster_ip']}',
post_username='{$row['post_username']}',
enable_bbcode='{$row['enable_bbcode']}',
enable_html='{$row['enable_html']}',
enable_smilies='{$row['enable_smilies']}',
enable_sig='{$row['enable_sig']}',
post_edit_time='{$row['post_edit_time']}',
post_edit_count='{$row['post_edit_count']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_posts_text
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_posts_text",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbposts_text SET
post_id='{$row['post_id']}',
bbcode_uid='{$row['bbcode_uid']}',
post_subject='{$row['post_subject']}',
post_text='{$row['post_text']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_privmsgs
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_privmsgs",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbprivmsgs SET
privmsgs_id='{$row['privmsgs_id']}',
privmsgs_type='{$row['privmsgs_type']}',
privmsgs_subject='{$row['privmsgs_subject']}',
privmsgs_from_userid='{$row['privmsgs_from_userid']}',
privmsgs_to_userid='{$row['privmsgs_to_userid']}',
privmsgs_date='{$row['privmsgs_date']}',
privmsgs_ip='{$row['privmsgs_ip']}',
privmsgs_enable_bbcode='{$row['privmsgs_enable_bbcode']}',
privmsgs_enable_html='{$row['privmsgs_enable_html']}',
privmsgs_enable_smilies='{$row['privmsgs_enable_smilies']}',
privmsgs_attach_sig='{$row['privmsgs_attach_sig']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_privmsgs_text
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_privmsgs_text",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbprivmsgs_text SET
privmsgs_text_id='{$row['privmsgs_text_id']}',
privmsgs_bbcode_uid='{$row['privmsgs_bbcode_uid']}',
privmsgs_text='{$row['privmsgs_text']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_ranks
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_ranks",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbranks SET
rank_id='{$row['rank_id']}',
rank_title='{$row['rank_title']}',
rank_min='{$row['rank_min']}',
rank_special='{$row['rank_special']}',
rank_image='{$row['rank_image']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_search_results
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_search_results",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbsearch_results SET
search_id='{$row['search_id']}',
session_id='{$row['session_id']}',
search_array='{$row['search_array']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_search_wordlist
/*mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_search_wordlist",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbsearch_wordlist SET
word_text='{$row['word_text']}',
word_id='{$row['word_id']}',
word_common='{$row['word_common']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);*/
// phpbb_search_wordmatch
/*mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_search_wordmatch",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbsearch_wordmatch SET
post_id='{$row['post_id']}',
word_id='{$row['word_id']}',
title_match='{$row['title_match']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);*/
// phpbb_sessions
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_sessions",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbsessions SET
session_id='{$row['session_id']}',
session_user_id='{$row['session_user_id']}',
session_start='{$row['session_start']}',
session_time='{$row['session_time']}',
session_ip='{$row['session_ip']}',
session_page='{$row['session_page']}',
session_logged_in='{$row['session_logged_in']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
// phpbb_smilies
mysql_select_db($p_db,$p_con);
$result=mysql_query("SELECT * FROM {$p_prefix}_smilies",$p_con);
$count=mysql_num_fields($result);
mysql_select_db($n_db,$n_con) or mysql_error();
while($row=mysql_fetch_array($result))
{
fixQuotes();
mysql_query("INSERT INTO {$n_prefix}_bbsmilies SET
smilies_id='{$row['smilies_id']}',
code='{$row['code']}',
smile_url='{$row['smile_url']}',
emoticon='{$row['emoticon']}'
",$n_con) or mysql_error();
}
mysql_free_result($result);
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum