diff --git a/phpBB/upgrade_20.php b/phpBB/upgrade_20.php
new file mode 100644
index 0000000000..dd9e0386db
--- /dev/null
+++ b/phpBB/upgrade_20.php
@@ -0,0 +1,466 @@
+> 24 ) & 0xFF ), ( ( $ip >> 16 ) & 0xFF ), ( ( $ip >> 8 ) & 0xFF ), ( ( $ip ) & 0xFF ) );
+ }
+ return($return);
+}
+
+function convert_date($date_in)
+{
+ list($date, $time) = split(" ", $date_in);
+ list($year, $month, $day) = split("-", $date);
+ list($hours, $minutes) = split(":", $time);
+ $timestamp = mktime($hours, $minutes, 0, $month, $day, $year);
+
+ return($timestamp);
+}
+
+function drop_column($db, $table, $column)
+{
+ $sql = "alter table $table drop $column";
+ if (!$r = mysql_query($sql, $db))
+ echo "ERROR! count not drop column $column from table $table. Reason: " . mysql_error(). "";
+}
+
+function change_column($db, $table, $column, $type, $null)
+{
+ $sql = "alter table $table change $column $column $type $null";
+ if (!$r = mysql_query($sql, $db))
+ echo "ERROR! count not change column $column from table $table. Reason: " . mysql_error(). "";
+}
+
+function add_column($db, $table, $column, $type, $null)
+{
+ $sql = "alter table $table add $column $type $null";
+ if (!$r = mysql_query($sql, $db))
+ echo "ERROR! count not add column $column from table $table. Reason: " . mysql_error(). "";
+}
+
+?>
+
+
+
+ phpBB - Database upgrade 1.2 to 2.0 Developers edition
+
+
+
+
+Step 1: Backup the tables to be modified.
";
+
+ if(!$db = mysql_connect("$dbhost", "$dbuser", "$dbpasswd"))
+ die("Error, I could not connect to the database at $dbhost. Using username $dbuser.
Please go back and try again.");
+
+ if(!@mysql_select_db("$dbname", $db))
+ die("Database $dbname could not be found");
+
+ $tables = array("posts" => "Y",
+ "priv_msgs" => "Y",
+ "sessions" => "Y",
+ "topics" => "Y",
+ "banlist" => "Y",
+ "config" => "N",
+ "forums" => "N",
+ "users" => "N",
+ "access" => "N",
+ "smiles" => "N",
+ "words" => "N",
+ "forum_mods" => "N");
+
+ while (list($table_name, $drop_table) = each($tables))
+ {
+ echo "Backing up the $table_name table...
";
+
+ $backup_name = $table_name . "_backup";
+ $table_create = "CREATE TABLE $backup_name (\n";
+
+ $r = mysql_query("show fields from $table_name", $db);
+
+ if (0 != mysql_errno($db))
+ {
+ die("Error, could not backup the table $table_name to $backup_name");
+ }
+ else
+ {
+ while ($row = mysql_fetch_array($r))
+ {
+ $table_create .= " $row[Field] $row[Type]";
+ if (isset($row["Default"]) && (!empty($row["Default"]) || $row["Default"] == "0"))
+ $table_create .= " DEFAULT '$row[Default]'";
+ if ($row["Null"] != "YES")
+ $table_create .= " NOT NULL";
+ if ($row["Extra"] != "")
+ $table_create .= " $row[Extra]";
+ $table_create .= ",\n";
+ }
+ /* The code above leaves extra ',' at the end of the row. use ereg_replace to remove it */
+ $table_create = ereg_replace(",\n$", "", $table_create);
+
+ echo " Extracted the table columns ...
\n";
+
+ unset($index);
+ $r = mysql_query("SHOW KEYS FROM $table_name", $db);
+ while($row = mysql_fetch_array($r))
+ {
+ $key_name = $row['Key_name'];
+ if (($key_name != "PRIMARY") && ($row['Non_unique'] == 0))
+ $key_name = "UNIQUE|$key_name";
+ if (!isset($index[$key_name]))
+ $index[$key_name] = array();
+ $index[$key_name][] = $row['Column_name'];
+ }
+
+ while(list($x, $columns) = @each($index))
+ {
+ $table_create .= ",\n";
+ if ($x == "PRIMARY")
+ $table_create .= " PRIMARY KEY (" . implode($columns, ", ") . ")";
+ elseif (substr($x,0,6) == "UNIQUE")
+ $table_create .= " UNIQUE " .substr($x,7). " (" . implode($columns, ", ") . ")";
+ else
+ $table_create .= " KEY $x (" . implode($columns, ", ") . ")";
+ }
+
+ echo " Extracted the table indexes ...
\n";
+
+ $table_create .= "\n)";
+ mysql_query($table_create, $db);
+ echo " Created the backup table $backup_name ...
\n";
+
+ mysql_query("insert into $backup_name select * from $table_name", $db);
+ echo " Copied the data from $table_name to $backup_name...
\n";
+
+ if ($drop_table == 'Y')
+ {
+ mysql_query("drop table $table_name", $db);
+ echo " Dropped table $table_name...
\n";
+ }
+ }
+ }
+?>
+Backups completed ok.
+