> 24 ) & 0xFF ), ( ( $ip >> 16 ) & 0xFF ), ( ( $ip >> 8 ) & 0xFF ), ( ( $ip ) & 0xFF ) ); } return($return); } function convert_date($date_in) { list($date, $time) = split(" ", $date_in); // UK/European format // list($day, $month, $year) = split("-", $date); // Original phpBB format list($year, $month, $day) = split("-", $date); list($hours, $minutes) = split(":", $time); $timestamp = gmmktime($hours, $minutes, 0, $month, $day, $year); return($timestamp); } // // Following functions adapted from phpMyAdmin // // Return table's CREATE definition // Returns a string containing the CREATE statement on success // function get_table_def($db, $table, $crlf) { $schema_create = ""; $schema_create .= "CREATE TABLE $table ($crlf"; $result =$db->sql_query("SHOW FIELDS FROM $table"); if(!$result) { $error = $db->sql_error(); error_die($db, GENERAL_ERROR, "Failed in get_table_def (show fields) : ".$error["message"]); } while ($row = $db->sql_fetchrow($result)) { $schema_create .= " $row[Field] $row[Type]"; if (!empty($row["Default"])){ $schema_create .= " DEFAULT '$row[Default]'"; } if ($row["Null"] != "YES"){ $schema_create .= " NOT NULL"; } if ($row["Extra"] != ""){ $schema_create .= " $row[Extra]"; } $schema_create .= ",$crlf"; } $schema_create = ereg_replace(",".$crlf."$", "", $schema_create); $result = $db->sql_query("SHOW KEYS FROM $table"); if(!$result) { $error = $db->sql_error(); error_die($db, GENERAL_ERROR, "Failed in get_table_content (show keys) : ".$error["message"]); } while ($row = $db->sql_fetchrow($result)){ $kname=$row['Key_name']; if (($kname != "PRIMARY") && ($row['Non_unique'] == 0)){ $kname="UNIQUE|$kname"; } if(!is_array($index[$kname])){ $index[$kname] = array(); } $index[$kname][] = $row['Column_name']; } while(list($x, $columns) = @each($index)){ $schema_create .= ",$crlf"; if($x == "PRIMARY"){ $schema_create .= " PRIMARY KEY (" . implode($columns, ", ") . ")"; } else if (substr($x,0,6) == "UNIQUE") { $schema_create .= " UNIQUE ".substr($x,7)." (" . implode($columns, ", ") . ")"; } else { $schema_create .= " KEY $x (" . implode($columns, ", ") . ")"; } } $schema_create .= "$crlf);"; return (stripslashes($schema_create)); } // // Get the content of table as a series of INSERT statements. // After every row, a custom callback function $handler gets called. // $handler must accept one parameter ($sql_insert); // function get_table_content($db, $table, $handler) { $result = $db->sql_query("SELECT * FROM $table"); if(!$result) { $error = $db->sql_error(); error_die($db, GENERAL_ERROR, "Failed in get_table_content (select * ) : ".$error["message"]); } $i = 0; while ($row = $db->sql_fetchrow($result)) { $schema_insert = "INSERT INTO $table VALUES("; for ($j=0; $j<$db->sql_numfields($result);$j++) { if (!isset($row[$j])) { $schema_insert .= " NULL,"; } elseif ($row[$j] != "") { $schema_insert .= " '".addslashes($row[$j])."',"; } else { $schema_insert .= " '',"; } } $schema_insert = ereg_replace(",$", "", $schema_insert); $schema_insert .= ");"; $handler(trim($schema_insert)); $i++; } return (true); } function output_table_content($content){ echo $content."\n"; return; } // // Nathan's bbcode2 conversion routines // function bbdecode($message) { // Undo [code] $code_start_html = "
Code:
";
		$code_end_html = "

"; $message = str_replace($code_start_html, "[code]", $message); $message = str_replace($code_end_html, "[/code]", $message); // Undo [quote] $quote_start_html = "
Quote:
"; $quote_end_html = "

"; $message = str_replace($quote_start_html, "[quote]", $message); $message = str_replace($quote_end_html, "[/quote]", $message); // Undo [b] and [i] $message = preg_replace("#(.*?)#s", "[b]\\1[/b]", $message); $message = preg_replace("#(.*?)#s", "[i]\\1[/i]", $message); // Undo [url] (long form) $message = preg_replace("#(.*?)#s", "[url=\\1\\2]\\3[/url]", $message); // Undo [url] (short form) $message = preg_replace("#(.*?)#s", "[url]\\3[/url]", $message); // Undo [email] $message = preg_replace("#(.*?)#s", "[email]\\1[/email]", $message); // Undo [img] $message = preg_replace("##s", "[img]\\1[/img]", $message); // Undo lists (unordered/ordered) //
  • tags: $message = str_replace("
  • ", "[*]", $message); // [list] tags: $message = str_replace("", "[/list]", $message); $message = str_replace("", "[/list]", $message); return($message); } /** * Nathan Codding - Feb 6, 2001 * Reverses the effects of make_clickable(), for use in editpost. * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. * */ function undo_make_clickable($text) { $text = preg_replace("#.*?#i", "\\1", $text); $text = preg_replace("#.*?#i", "\\1", $text); return $text; } // // End function defns // ?> Step 1: Backup critical tables.
    "; echo "

    Click the Backup button to commence a download of the critical tables in your current database. You will be prompted for a download location for the backup file, please note that the download may be large (and hence take a long time) depending on how many posts/users/forums/etc. you have. When the download has completed (and not before!) click the Next button to continue.


    \n\n"; echo "
    \n"; echo "\n"; echo "\n"; echo "
    \n\n"; echo "
    \n"; echo " \">\n"; echo "\n"; echo "
    \n\n"; common_footer(); exit; } header("Content-Type: text/x-delimtext; name=\"phpbb_db_backup.sql\""); header("Content-disposition: filename=phpbb_db_backup.sql"); header("Pragma: no-cache"); ?> # # phpBB upgrade script # Dump of critical tables for $dbname; # # DATE : # # # TABLE : # Step 2: Create new tables.
    "; if(file_exists("./db/mysql_schema.sql")){ $sql_query = fread(fopen("./db/mysql_schema.sql", "r"),filesize("./db/mysql_schema.sql")); $sql_lines = explode(");\n", preg_replace("/(#.*\n)/", "", $sql_query)); $error = false; $uploaded = 0; for($i=0;$i 2) { echo $sql_lines[$i].")\n\n

    \n\n"; $sql_lines[$i] = $sql_lines[$i].")"; $result = $db->sql_query($sql_lines[$i]); if(!$result){ die("Error creating new tables"); } } } } ?>

    Tables created

    Step 3: Move the data to the new tables..
    "; echo "

    Now all the your old phpBB data will be moved and updated (where necessary) to the newly created phpBB2 tables. If you wish you can automatically delete your old data by checking the delete old data box below. Only do this if you backed up your data earlier! Click the Convert button to commence the operation.

    \n\n"; echo "
    \n"; echo "Delete Old Data     "; echo "\n"; echo "\n"; echo "\n"; echo "
    \n\n"; common_footer(); exit; } common_header(); // // Go through tables one by one // could do this via arrays I guess ... // // banlist // echo "

    Moving banlist ... "; $result = $db->sql_query("SELECT * FROM banlist"); if(!$result) { die("Failed selecting from banlist"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_banlist (ban_id, ban_userid, ban_ip, ban_start, ban_end, ban_time_type) VALUES ('".$row["ban_id"]."', '".$row["ban_userid"]."', '".convert_ip($row["ban_ip"])."', '".$row["ban_start"]."', '".$row["ban_end"]."', '".$row["ban_time_type"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_banlist"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM banlist WHERE ban_id = '".$row["ban_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from banlist"); } } } } echo "DONE

    \n"; // // catagories // echo "

    Moving catagories ... "; $result = $db->sql_query("SELECT * FROM catagories"); if(!$result) { die("Failed selecting from catagories"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES ('".$row["cat_id"]."', '".$row["cat_title"]."', '".$row["cat_order"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_categories"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM catagories WHERE cat_id = '".$row["cat_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from catagories"); } } } } echo "DONE

    \n"; // // config // echo "

    Moving config ... "; $result = $db->sql_query("SELECT * FROM config"); if(!$result) { die("Failed selecting from config"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_config (config_id, sitename, allow_html, allow_bbcode, allow_sig, allow_namechange, selected, posts_per_page, hot_threshold, topics_per_page, allow_theme_create, override_themes, email_sig, email_from, default_lang) VALUES ('".$row["config_id"]."', '".$row["sitename"]."', '".$row["allow_html"]."', '".$row["allow_bbcode"]."', '".$row["allow_sig"]."', '".$row["allow_namechange"]."', '".$row["selected"]."', '".$row["posts_per_page"]."', '".$row["hot_threshold"]."', '".$row["topics_per_page"]."', '".$row["allow_theme_create"]."', '".$row["override_themes"]."', '".$row["email_sig"]."', '".$row["email_from"]."', '".$row["default_lang"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_config"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM config WHERE config_id = '".$row["config_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from config"); } } } } echo "DONE

    \n"; // // disallow // echo "

    Moving disallow ... "; $result = $db->sql_query("SELECT * FROM disallow"); if(!$result) { die("Failed selecting from disallow"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_disallow (disallow_id, disallow_username) VALUES ('".$row["disallow_id"]."', '".$row["disallow_username"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_disallow"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM disallow WHERE disallow_id = '".$row["disallow_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from disallow"); } } } } echo "DONE

    \n"; // // forum_access // echo "

    Moving forum_access ... "; $result = $db->sql_query("SELECT * FROM forum_access"); if(!$result) { die("Failed selecting from forum_access"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_forum_access (forum_id, user_id, can_post) VALUES ('".$row["forum_id"]."', '".$row["user_id"]."', '".$row["can_post"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_forum_access"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM forum_access WHERE forum_id = '".$row["forum_id"]."' AND user_id = '".$row["user_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from forum_access"); } } } } echo "DONE

    \n"; // // forum_mods // echo "

    Moving forum_mods ... "; $result = $db->sql_query("SELECT * FROM forum_mods"); if(!$result) { die("Failed selecting from forum_mods"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_forum_mods (forum_id, user_id) VALUES ('".$row["forum_id"]."', '".$row["user_id"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_forum_mods"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM forum_mods WHERE forum_id = '".$row["forum_id"]."' AND user_id = '".$row["user_id"]."'"; if(!$delete_result) { die("Failed deleting data from forum_mods"); } } } } echo "DONE

    \n"; // // forums // echo "

    Moving forums ... "; $result = $db->sql_query("SELECT * FROM forums"); if(!$result) { die("Failed selecting from forums"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "SELECT COUNT(*) AS forum_topics FROM topics WHERE forum_id = '".$row["forum_id"]."'"; $numtopics_result = $db->sql_query($sql); if(!$numtopics_result) { die("Failed obtaining number of topics for this forum!"); } $row["forum_topics"] = $db->sql_fetchfield("forum_topics",-1, $numtopics_result); $sql = "SELECT COUNT(*) AS forum_posts, MAX(post_id) AS forum_last_post_id FROM posts WHERE forum_id = '".$row["forum_id"]."'"; $numposts_result = $db->sql_query($sql); if(!$numposts_result) { die("Failed obtaining number of posts/last_post_id for this forum!"); } $row["forum_posts"] = $db->sql_fetchfield("forum_posts",-1, $numposts_result); $row["forum_last_post_id"] = $db->sql_fetchfield("forum_last_post_id",-1, $numposts_result); $sql = "INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, forum_access, cat_id, forum_order, forum_type, forum_posts, forum_topics, forum_last_post_id) VALUES ('".$row["forum_id"]."', '".addslashes($row["forum_name"])."', '".addslashes($row["forum_desc"])."', '".$row["forum_access"]."', '".$row["cat_id"]."', '".$row["forum_order"]."', '".$row["forum_type"]."', '".$row["forum_posts"]."', '".$row["forum_topics"]."', '".$row["forum_last_post_id"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_forums"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM forums WHERE forum_id = '".$row["forum_id"]."' AND cat_id = '".$row["cat_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from forum_mods"); } } } } echo "DONE

    \n"; // // headermetafooter // echo "

    Moving headermetafooter ... "; $result = $db->sql_query("SELECT * FROM headermetafooter"); if(!$result) { die("Failed selecting from headermetafooter"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_headermetafooter (header, meta, footer) VALUES ('".$row["header"]."', '".$row["meta"]."', '".$row["footer"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_headermetafooter"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM headermetafooter WHERE header = '".$row["header"]."' AND meta = '".$row["meta"]."' AND footer = '".$row["footer"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from headermetafooter"); } } } } echo "DONE

    \n"; // // priv_msgs // echo "

    Moving priv_msgs ... "; $result = $db->sql_query("SELECT * FROM priv_msgs"); if(!$result) { die("Failed selecting from priv_msgs"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_priv_msgs (msg_id, from_userid, to_userid, msg_time, poster_ip, msg_status, msg_text) VALUES ('".$row["msg_id"]."', '".$row["from_userid"]."', '".$row["to_userid"]."', '".convert_date($row["msg_time"])."', '".convert_ip($row["poster_ip"])."', '".$row["msg_status"]."', '".addslashes($row["msg_text"])."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_priv_msgs"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM priv_msgs WHERE msg_id = '".$row["msg_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from priv_msgs"); } } } } echo "DONE

    \n"; // // ranks // echo "

    Moving ranks ... "; $result = $db->sql_query("SELECT * FROM ranks"); if(!$result) { die("Failed selecting from ranks"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_ranks (rank_id, rank_title, rank_min, rank_max, rank_special, rank_image) VALUES ('".$row["rank_id"]."', '".addslashes($row["rank_title"])."', '".$row["rank_min"]."', '".$row["rank_max"]."', '".$row["rank_special"]."', '".$row["rank_image"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_ranks"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM ranks WHERE rank_id = '".$row["rank_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from ranks"); } } } } echo "DONE

    \n"; // // themes // echo "

    Moving ranks ... "; $result = $db->sql_query("SELECT * FROM themes"); if(!$result) { die("Failed selecting from themes"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_themes (theme_id, theme_name, bgcolor, textcolor, color1, color2, table_bgcolor, header_image, newtopic_image, reply_image, linkcolor, vlinkcolor, theme_default, fontface, fontsize1, fontsize2, fontsize3, fontsize4, tablewidth, replylocked_image) VALUES ('".$row["theme_id"]."', '".addslashes($row["theme_name"])."', '".$row["bgcolor"]."', '".$row["textcolor"]."', '".$row["color1"]."', '".$row["color2"]."', '".$row["table_bgcolor"]."', '".$row["header_image"]."', '".$row["newtopic_image"]."', '".$row["reply_image"]."', '".$row["linkcolor"]."', '".$row["vlinkcolor"]."', '".$row["theme_default"]."', '".$row["fontface"]."', '".$row["fontsize1"]."', '".$row["fontsize2"]."', '".$row["fontsize3"]."', '".$row["fontsize4"]."', '".$row["tablewidth"]."', '".$row["replylocked_image"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_themes"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM themes WHERE theme_id = '".$row["theme_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from themes"); } } } } echo "DONE

    \n"; // // topics // echo "

    Moving topics ... "; $result = $db->sql_query("SELECT * FROM topics ORDER BY topic_time DESC"); if(!$result) { die("Failed selecting from topics"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "SELECT COUNT(*) AS topic_replies, MAX(post_id) AS topic_last_post_id FROM posts WHERE topic_id = '".$row["topic_id"]."'"; $numtopics_result = $db->sql_query($sql); if(!$numposts_result) { die("Failed obtaining number of replies/last_post_id for this topic!"); } $row["topic_replies"] = $db->sql_fetchfield("topic_replies",-1, $numtopics_result) - 1; $row["topic_last_post_id"] = $db->sql_fetchfield("topic_last_post_id",-1, $numtopics_result); $sql = "INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, forum_id, topic_status, topic_notify, topic_last_post_id) VALUES ('".$row["topic_id"]."', '".addslashes($row["topic_title"])."', '".$row["topic_poster"]."', '".convert_date($row["topic_time"])."', '".$row["topic_views"]."', '".$row["topic_replies"]."', '".$row["forum_id"]."', '".$row["topic_status"]."', '".$row["topic_notify"]."', '".$row["topic_last_post_id"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_topics"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM topics WHERE topic_id = '".$row["topic_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from topics"); } } } } echo "DONE

    \n"; // // posts/post_text // echo "

    Moving posts & post_text ... "; $result = $db->sql_query("SELECT * FROM posts ORDER BY post_id"); if(!$result) { die("Failed selecting from posts"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { // // Nathan's bbcode2 conversion // // undo 1.2.x encoding.. $row['post_text'] = bbdecode($row['post_text']); $row['post_text'] = undo_make_clickable($row['post_text']); $row['post_text'] = str_replace("
    ", "\n", $row['post_text']); // make a uid $uid = make_bbcode_uid(); // do 2.x first-pass encoding.. $row['post_text'] = bbencode_first_pass($row['post_text'], $uid); $row['post_text'] = addslashes($row['post_text']); $sql = "INSERT INTO phpbb_posts (post_id, topic_id, forum_id, poster_id, post_time, poster_ip, bbcode_uid) VALUES ('".$row["post_id"]."', '".$row["topic_id"]."', '".$row["forum_id"]."', '".$row["poster_id"]."', '".convert_date($row["post_time"])."', '".convert_ip($row["poster_ip"])."', '".$uid."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_posts"); } $sql = "INSERT INTO phpbb_posts_text (post_id, post_text) VALUES ('".$row["post_id"]."', '".addslashes($row["post_text"])."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_posts_text"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM posts WHERE post_id = '".$row["post_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from posts"); } } } } echo "DONE

    \n"; // // users // echo "

    Moving users ... "; $result = $db->sql_query("SELECT * FROM users"); if(!$result) { die("Failed selecting from users"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_intrest, user_sig, user_viewemail, user_theme, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_desmile, user_html, user_bbcode, user_rank, user_avatar, user_level, user_lang, user_actkey, user_newpasswd, user_notify) VALUES ('".$row["user_id"]."', '".($row["username"])."', '".$row["user_regdate"]."', '".$row["user_password"]."', '".$row["user_email"]."', '".$row["user_icq"]."', '".$row["user_website"]."', '".$row["user_occ"]."', '".addslashes($row["user_from"])."', '".addslashes($row["user_intrest"])."', '".addslashes($row["user_sig"])."', '".$row["user_viewemail"]."', '".$row["user_theme"]."', '".$row["user_aim"]."', '".$row["user_yim"]."', '".$row["user_msnm"]."', '".$row["user_posts"]."', '".$row["user_attachsig"]."', '".$row["user_desmile"]."', '".$row["user_html"]."', '".$row["user_bbcode"]."', '".$row["user_rank"]."', '".$row["user_avatar"]."', '".$row["user_level"]."', '".$row["user_lang"]."', '".$row["user_actkey"]."', '".$row["user_newpasswd"]."', '".$row["user_notify"]."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_users"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM users WHERE user_id = '".$row["user_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from users"); } } } } echo "DONE

    \n"; // // words // echo "

    Moving words ... "; $result = $db->sql_query("SELECT * FROM words"); if(!$result) { die("Failed selecting from words"); } if($db->sql_numrows($result)) { while($row = $db->sql_fetchrow($result)) { $sql = "INSERT INTO phpbb_words (word_id, word, replacement) VALUES ('".$row["word_id"]."', '".addslashes($row["word"])."', '".addslashes($row["replacement"])."')"; $insert_result = $db->sql_query($sql); if(!$insert_result) { die("Failed inserting data into phpbb_words"); } if(isset($HTTP_POST_VARS["deleteolddata"])) { $sql = "DELETE FROM words WHERE word_id = '".$row["word_id"]."'"; $delete_result = $db->sql_query($sql); if(!$delete_result) { die("Failed deleting data from words"); } echo "
    \n"; } } } echo "DONE
    \n"; if(isset($HTTP_POST_VARS["deleteolddata"])) { $old_tables = array("access", "banlist", "catagories", "config", "disallow", "forum_access", "forum_mods", "forums", "headermetafooter", "posts", "priv_msgs", "ranks", "sessions", "smiles", "themes", "topics", "users", "whosonline", "words"); echo "

    Removing phpBB 1.x tables ... "; for($i=0;$isql_query("DROP TABLE ".$old_tables[$i]); if(!$result) { die("Couldn't drop table : ".$old_tables[$i]); } } echo "DONE

    "; } ?>

    All operations completed!

    You should now clear your browsers cookie cache and try accessing your new phpBB2 install.

    Welcome! This script will upgrade your phpBB v1.2 database to version 2.0. Please note that it assumes a clean database structure is present. If you've introduced any hacks which change the field names or types, or have added additional fields or tables then this script may well fail.

    The upgrade will perform the following functions: