把以下的檔案存成 ubb-phpbb2.php就可以了
可以轉換會員資料
<?php
/******************************************************************************
Amended on 10th January 2001
Convertor for UBB6 to phpbb 2.0
I took the old script from Kevin (THANX A MILLION KEVIN!). I amended
it a little (about just 5% of it) to suit the db structure for phpbb2.0
Somethings changed:
- appending of phpbb_ to all tables (you have to find and change it is you have a different prefix)
- changing of $total to reflect reverse numbering. It seems Kevin placed the oldest as the newest user
- changing debug output
- addition of mktime to reflect epoch timing
- changed about 10% of codes :P
- tested on ubb 6.1
by theagent (Ivan Tan - sky@aquarealms.com)
******************************************************************************/
/******************************************************************************
This script was used to convert my Ultimate BBS 6.04C users to
phpBB 1.40 users. Let me know if you have any problems and I'll
be happy to help you out.
Usage Instructions:
Copy this script (remove the .txt) into a directory that is available via
a web browser. Set the $memberpath as instructed below. Set the MySQL
parameters $dbhost,$dbname,$dbuser and $dbpass.
Load this script into your browser and convert your users.
Happy Converting!
Kevin - kevin@kevincurtis.org
******************************************************************************/
// Updated to work with 6.04 UBB
// will not get the priv's but will transfer the rest.
?>
<html>
<head>
<title>UBB 6.04C to PhpBB 2.0 User Conversion</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#0000FF" alink="#FF0000">
<font face="Verdana, Arial"><div align="center"><b>UBB 6.04c to PhpBB 2.0</b></div><p><font size="-1">
<?
// Define you Members path here in one of 2 ways. Local: c:\Inetpub\webroot\Members\\\"
// For Windows Users:
// $memberpath = "C:\Inetpub\webroot\Members\\\";
// For ?nix users:
// $memberpath = "/root/http/uub/members/";
// or URL Based like below...
// $memberpath = getcwd()."/Members/"; // In this case this file is located in the Web Root directory, which contains a members folder.
$memberpath = "";
echo "<br>Members path: $memberpath";
//exit;
clear;
$dbhost = "";
$dbname = "";
$dbuser = "";
$dbpass = "";
$numrows = 0;
$result = 0;
function valid_email ($email)
{
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,3}$", $email, $check))
{
if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
{
return TRUE;
}
}
return FALSE;
}
printf("<br>Connecting to Database...<br>");
$db = mysql_connect("$dbhost", "$dbuser", "$dbpass") or
die("<P>Error: could not connect to the database. Using username $dbuser and password $dbpass.<BR>Please go back and try again.");
@mysql_select_db("$dbname", $db) or die ("<P>Error: Could not open database.");
printf("Connected to Database Successfully.");
// open directory, load member filenames into array
printf("<br>Opening Members path: $memberpath");
$handle = opendir($memberpath);
$a = 0;
while ($file = readdir($handle))
{
if((preg_match('/00/', $file)))
{
printf("<br>processing member file: $memberpath$file<br>");
$member = file("$memberpath$file");
$username = addslashes(trim($member[0]));
$sql_select = "select username from phpbb_users where username = '$username'";
printf("<br>Looking for username: $username");
$result = mysql_query($sql_select,$db);
if($result)
{
$numrows = mysql_num_rows($result);
if ($numrows > 0)
printf(" - username already in table!<br>");
else
{
$members[$a] = $file;
echo "<br>file $a: $file";
$a++;
}
}
}
}
closedir($handle);
// count remaining elements of array
$i = count($members) -1;
// reversing (crude but it does the job)
$tempmembers = $members;
$count = 0;
while( $i >= 0 )
{
$members[$i] = $tempmembers[$count];
$i--;
$count++;
}
// count remaining elements of array
$i = count($members) -1;
// insert data into phpBB mysql database
$t = $i +1;
// for each member, gather data for import
echo "<br>Processing $t members .";
while ( $i >= 0 )
{
//$member = explode( "|", $members[$i]);
$member = file("$memberpath$members[$i]");
$username = addslashes(trim($member[0]));
$user_password = md5(trim($member[1]));
//$user_password = trim($member[1]);
$user_email = trim($member[2]);
//if ( !valid_email($user_email) ) { $user_email = ""; }
$user_website = trim($member[3]);
//$user_rights = trim($member[4]);
$user_occ = addslashes(trim($member[5]));
$user_from = addslashes(trim($member[6]));
$user_posts = trim($member[7]);
//echo "<br>user_rank: $member[8]);
$user_intrest = addslashes(trim($member[9]));
$user_regdate = trim($member[10]);
list ($xpmonth, $xpday, $xpyear) = split ('[/.-]', $user_regdate);
$user_regdate = mktime(1,1,1,$xpmonth,$xpday,$xpyear);
$user_sig = addslashes(trim($member[12]));
echo ".";
$sql = "SELECT max(user_id) AS total FROM phpbb_users";
if(!$r = mysql_query($sql, $db))
die("Error connecting to the database.");
list($total) = mysql_fetch_array($r);
$total += 1;
// $sql = "INSERT INTO phpbb_users (user_id, username, user_regdate, user_email, user_icq, user_password, user_occ, user_interests, user_from, user_website, user_sig, user_aim, user_viewemail, user_yim, user_msnm)
// VALUES ('$total', '$username', '$regdate', '$email', '$icq', '$passwd', '$occ', '$intrest', '$from', '$website', '$sig', '$aim', '$sqlviewemail', '$yim', '$msnm')";
$sql = "insert into phpbb_users ( user_id, username, user_regdate, user_password, user_email, user_website, user_occ, user_from, user_posts, user_interests, user_sig ) values ('$total','$username', '$user_regdate', '$user_password', '$user_email', '$user_website', '$user_occ', '$user_from', '$user_posts', '$user_intrest', '$user_sig' );";
printf("%s <br>",$sql) ; // un comment to debug
if ($username)
{
$sql = "insert into phpbb_users ( user_id, username, user_regdate, user_password, user_email, user_website, user_occ, user_from, user_posts, user_interests, user_sig ) values ('$total','$username', '$user_regdate', '$user_password', '$user_email', '$user_website', '$user_occ', '$user_from', '$user_posts', '$user_intrest', '$user_sig' );";
if ($sql)
{
printf("<br>Inserting Record...<br>");
$result=mysql_query($sql,$db);
if (!$result)
{
$msg.= "Mysql error: ".mysql_error($db)."<br>";
printf("<br>Mysql error: ".mysql_error($db)."<br>");
}
else if (mysql_affected_rows() < 1) {
printf("<br>Insert failed for user: $username<br>");
}
}
}
else
printf("<br>User already in database: $username<br>");
$i--;
}
mysql_close($db);
echo "<P>Done Processing!";
exit;
?>
</body>
</html>
[轉貼]UBB 2 PHPBB2
phpBB Installation & Usage Support
phpBB 2 安裝於各類型作業平台之問題討論;外掛問題,請到相關版面依發問格式發表!
(發表文章請按照公告格式發表,違者砍文)
phpBB 2 安裝於各類型作業平台之問題討論;外掛問題,請到相關版面依發問格式發表!
(發表文章請按照公告格式發表,違者砍文)
版主: 版主管理群
版面規則
本區是討論關於 phpBB 2.0.X 架設安裝上的問題,只要有安裝任何外掛,請到外掛討論相關版面按照公告格式發表。
(發表文章請按照公告格式發表,違者砍文)
本區是討論關於 phpBB 2.0.X 架設安裝上的問題,只要有安裝任何外掛,請到外掛討論相關版面按照公告格式發表。
(發表文章請按照公告格式發表,違者砍文)
前往
- Announcement
- ↳ 系統公告區
- Support
- ↳ [3.3.x] 安裝與使用
- ↳ [3.3.x] 中文
- ↳ [3.3.x] 轉換
- Extensions
- ↳ 官方認證擴充功能
- ↳ [3.3.x] 官方認證擴充功能
- ↳ 非官方認證擴充功能
- ↳ 擴充功能問題討論
- Style
- ↳ 官方認證風格
- ↳ [3.3.x] 官方認證風格
- ↳ 非官方認證風格
- ↳ 風格問題討論
- Knowledge
- ↳ 教學文件庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- ↳ 3.3
- ↳ phpBB 技術文件與知識庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- Non-phpBB specific
- ↳ 塔羅占卜
- ↳ 塔羅精華
- ↳ 每週運勢
- ↳ 我想發問
- ↳ 站長交流
- ↳ 自由軟體或免費軟體
- ↳ 架站
- ↳ AppServ
- ↳ WampServer
- ↳ XAMPP
- ↳ phpMyAdmin
- ↳ ExoBUD MP
- ↳ 4images
- ↳ Coppermine Photo Gallery
- ↳ 網路
- ↳ 文書
- ↳ 檔案
- ↳ 美工
- ↳ 系統
- ↳ 安全
- ↳ 多媒體
- ↳ 遊戲
- ↳ 光碟
- ↳ 休閒哈拉與心情小品
- ↳ 意見反應或無法分類
- Link
- ↳ 竹貓星球數位(股)
- ↳ FaceBook_phpBB3-官方中文支援
- ↳ SSD 不限流量-網站空間( .tw or .com.tw域名免費送)
- ↳ 推薦網站
- ↳ phpBB.com
- ↳ phpBBHacks.com
- Archives
- ↳ phpBB 3.2.x Forum Archive
- ↳ [3.2.x] 安裝與使用
- ↳ [3.2.x] 中文
- ↳ [3.2.x] 轉換
- ↳ [3.2.x] 官方認證擴充功能
- ↳ [3.2.x] 官方認證風格
- ↳ phpBB 3.1.x Forum Archive
- ↳ [3.1.x] 安裝與使用
- ↳ [3.1.x] 中文
- ↳ [3.1.x] 轉換
- ↳ [3.1.x] 官方認證風格
- ↳ phpBB 3.0.x Forum Archive
- ↳ [3.0.x] Support
- ↳ [3.0.x] 安裝與使用
- ↳ [3.0.x] 中文
- ↳ [3.0.x] 轉換
- ↳ [3.0.x] Mod
- ↳ [3.0.x] 官方認證外掛
- ↳ [3.0.x] 非官方認證外掛
- ↳ [3.0.x] 外掛問題討論
- ↳ [3.0.x] Style
- ↳ [3.0.x] 官方認證風格
- ↳ [3.0.x] 非官方認證風格
- ↳ [3.0.x] 風格問題討論
- ↳ phpBB2 Forum Archive
- ↳ Support
- ↳ phpBB 2 安裝與使用
- ↳ phpBB 2 plus 綜合討論
- ↳ MOD
- ↳ 官方認證外掛
- ↳ 非官方認證外掛
- ↳ 外掛問題討論
- ↳ Style
- ↳ 官方認證風格
- ↳ 非官方認證風格
- ↳ 風格問題討論
