BBSXP7.01转DZ4.0的程序,怎么转完时间总是回到1970.1.1日?
<?php
##############################################################################
#
# BBSXP 7.00 Beta 1 ACCESS 转换到 Discuz!4.1.0
#
###############################################################################
#
# 使用完本程序请务必删除, 否则可能被别人再次转换,覆盖掉 Discuz! 论坛新贴.
#
################################################################################
//请仔细设置下面的参数=============================================================================================================================
$access_mdb = 'D:/DiscuzEXP/wwwroot/dz410/BBSXP7.mdb';// BBSXP 7.x Access 论坛数据库文件,绝对路径
$access_uid = ''; // 访问 access 数据库文件的用户名,一般默认为空
$access_pwd = ''; // 访问 access 数据库文件的密码,一般默认为空
$bbsxp_tblpre = 'bbsxp_'; // BBSXP 的数据表前缀
$bbsxp_posttbl = 'bbsxp_posts'; // bbsxp 帖子数据表,默认为 bbsxp_posts
// 如有多个帖子表请用半角逗号“,”隔开,如:bbsxp_posts,bbsxp_posts1,bbsxp_posts2
// 不确定请用 ACCESS 打开数据库文件查看
//================================================================================================================================================
$mysql_dbhost = 'localhost:6033'; // MYSQL 数据库服务器,形如:127.0.0.1:6033,一般为 localhost
$mysql_dbuser = 'root'; // 连接MYSQL数据库服务器的用户名
$mysql_dbpw = ''; // 连接MYSQL数据库服务器的密码
$mysql_dbname = 'dz410'; // Discuz! 数据库名字
$dz_tblpre = 'cdb_'; // Discuz! 表名前缀
$mysql_charset = 'gbk'; // 如果您的mysql是4.1及以上版本,请根据您要使用的 discuz 语言包做相应的设置
// 可以为:'gbk'、'utf8'、'big5'
//================================================================================================================================================
$rpp = 5000; // 每次需要转换的数量,如果您的服务器比较慢,请将这个值调小
$reportfile = 'forumdata/report.htm'; // 用来记录转换结果分析报告,该文件所在目录须具有可写权限
//下面部分非必要不需改动=============================================================================================================================
error_reporting(7);
@set_time_limit(1000);
$scriptname = 'bbsxp700b1acc-dz410.php';
$discuz_ver = 'Discuz! 4.1.0';
$source_ver = 'BBSXP 7.00 Beta 1 ACCESS';
register_shutdown_function('adodbClose');
$action = array(
'1'=>'准备开始转换',
'2'=>'转换论坛基本设置数据',
'3'=>'转换会员数据',
'4'=>'转换论坛版块数据',
'5'=>'转换主题数据',
'6'=>'转换帖子数据',
'7'=>'主题作者 uid 对应关系',
'8'=>'帖子作者 uid 对应关系',
'9'=>'帖子所在版块 fid 对应关系',
'10'=>'转换短消息数据',
'11'=>'转换论坛公告数据',
'12'=>'联盟论坛数据',
);
$timestamp = time();
$steps = count($action);
$step = isset($_GET['step']) ? $_GET['step'] : 1;
$start = isset($_GET['start']) && $_GET['start'] > 1 ? $_GET['start'] : 1;
$limit_start = $start - 1;
$actionnow = isset($action[$step]) ? $action[$step] : '结束';
$end = $start + $rpp - 1;
$stay = isset($_GET['stay']) ? $_GET['stay'] : 0;
$converted = 0;
$totalrows = isset($_GET['totalrows']) ? $_GET['totalrows'] : 0;
$convertedrows = isset($_GET['convertedrows']) ? $_GET['convertedrows'] : 0;
$maxid = isset($_GET['maxid']) ? $_GET['maxid'] : 0;
echo dheader();
$dbc = new com("adodb.connection");
@$dbc->open("DRIVER={Microsoft Access Driver (*.mdb)};dbq=$access_mdb;uid=$access_uid;pwd=$access_pwd");
if($dbc->state == 0) {
@$dbc->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$access_mdb");
if($dbc->state == 0) {
dexit("无法打开 access 数据库文件!可能原因:<br><blockquote>1.找不到文件 '$access_mdb' ,请检查 access 数据库文件路径设置是否正确,当前程序路径:".dirname(__FILE__).";<br>2.不可识别的数据库格式,如果您确认这是一个合法的 $source_ver 数据库文件,请使用 Access 软件打开并修复后再试!<br>3.工作组信息文件丢失,或是已被其它用户以独占方式打开。<br>4.access 数据库文件访问权限不足,请设置 access 数据库文件完全控制权限,access 数据库文件所在目录可写权限,windows 系统 temp 目录可写权限;<br>5.access 数据库文件设置了用户组访问权限,请正确设置数据库用户名密码。</blockquote>", 'access');
}
}
@mysql_connect($mysql_dbhost, $mysql_dbuser, $mysql_dbpw) or dexit("<span style='color:red;font-size:12px'>MySQL 数据库连接错误!请检查数据库主机变量设置是否正确!!!</span>");
@mysql_select_db($mysql_dbname) or dexit("选择 MySQL 数据库出错!");
if (@mysql_get_server_info() > '4.1' && in_array(strtolower($mysql_charset), array('gbk', 'big5', 'utf8'))) {
@mysql_query("SET NAMES '$mysql_charset';") or dexit("设置 MySQL 字符集($mysql_charset)出错,请检查配置的字符集以及 MySQL 版本是否正确!");
}
if(@mysql_get_server_info() > '5.0.1') {
@mysql_query("SET sql_mode=''");
}
if(($step == 2 || ($step > 2 && $step <= $steps && $stay == 1)) && $start <= 1) {
@unlink($reportfile);
reportlog("<html><head><title>$source_ver => $discuz_ver 转换结果分析报告</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gbk\">\r\n</head><body><p align='center'><b>$source_ver => $discuz_ver 转换结果分析报告</b></p><hr>\r\n");
}
if ($step > 1 && $step < $steps + 1) {
if($start <= 1) {
reportlog("\r\n第 $step 步:$actionnow<br>\r\n");
}
echo "<table border='0' width='85%'><tr><td>\r\n";
echo "<b>当前操作第 $step / ".($steps + 1)." 步 => $actionnow</b><br>\r\n";
echo " <span style='color:blue'><li>正在处理第 ".$start." —— ".$end." 行数据......</li></span><br><br>\r\n";
echo " <b>[<a href='$scriptname'>中止操作并返回程序首页</a>]</b><br>\r\n";
echo "</td></tr></table>\r\n";
}
if ($step == 1) {
@mysql_query("UPDATE '{$dz_tblpre}settings' SET 'value' = '1' WHERE 'variable' = 'bbclosed' LIMIT 1;");
@mysql_query("UPDATE '{$dz_tblpre}settings' SET 'vaule' = '论坛维护中,请稍候访问。谢谢合作!' WHERE 'variable' = 'closedreason' LIMIT 1;");
echo "<title>欢迎使用 $source_ver to $discuz_ver 转换程序</title>\n";
echo "<center><b>欢迎使用 $source_ver to $discuz_ver 转换程序</b></center><br>\n";
echo "<table border=0 width=100%><tr><td style='line-height:150%'>";
?>
本程序可实现 <?=$source_ver?> 数据到 <?=$discuz_ver?> 的安全数据转换。<font color=red>一旦您执行了本程序,则自动会将您的 <?=$discuz_ver?> 论坛设置为关闭状态。如果开启请点击“结束本程序”即可。</font><br>
请确认您用安装向导成功安装了 <?=$discuz_ver?><br><br>
<b>转换前的一些说明</b>:<br>
1.本程序可以转换的数据包括:论坛基本设置数据、用户的基本信息(<?=$source_ver?> 存在的且 <?=$discuz_ver?> 需要的数据)、版块数据、主题数据、帖子数据、短消息数据、公告数据、联盟论坛数据。<br>
2.转换前请详细配置本程序需要的参数。<br>
3.转换前请核查一下所使用的 BBSXP 数据字段是否同转换程序中使用的相符(BBSXP 每个版本(或者用户)的字段结构和名称都有可能不同),本程序针对标准的未做过修改的 <?=$source_ver?> 而设计。<br>
4.如果转换过程中出现超时,请把 $rpp 变量设置小一点.如果中间出现转换超时,可以修改本程序设置,重新再来.<br>
5.转换过程是自动的(如果不出现错误)!您不需干预,请静静等待出现转换全部成功的提示<br>
6.由于转换过程非常消耗资源所以请尽量在您的服务器空闲期间进行。<br><br>
7.<b>数据转换说明</b>:<br>
1.转换完毕后的数据并不一定同原论坛数据完全相同(非法长度的用户名(超过15字节)、非法长度的标题(超过80字节)、附件未写入到SQL数据库中的等等都不可转换或只部分转换)。<br>
2.转换过程需要的时间根据您的数据量大小、数据结构的标准与否、执行转换程序的平台性能等等都有一定关系。<br>
3.转换完成以后请将 bbsxp 的附件目录 UpFile 及其下的所有文件及目录移至 discuz 根目录下;请用您的管理员帐号登陆论坛后台执行<font color=red>更新论坛统计</font><b><font color=red>更新缓存</font>操作<br><br>
〖<a href="<?=$scriptname?>?step=2">点击开始转换</a>〗〖<a href='./index.php' target=_blank>点击进入论坛维护</a>〗〖<a href="<?=$scriptname?>?step=<?=($steps+1)?>">结束本程序</a>〗〖<a href='javascript:window.close()'>关闭窗口</a>〗
<hr size=2>
<b>单独转换:</b>(请注意:以下为分步单独转换,执行完所进行操作后程序不会自动进入下一步转换操作.)
<div style='padding-left:60px;line-height:160%'>
<?
foreach ($action AS $astep=>$aaction) {
if ($astep != 1) {
echo " <li>单独[<a href='".$scriptname."?step=".$astep."&stay=1'>$aaction</a>]</li>\r\n";
}
}
echo " <li>[<a href='".$scriptname."?step=".($steps + 1)."&stay=1'>进入到结束界面</a>]</li>\r\n";
echo " </div>\r\n";
echo " </td>\r\n";
echo " </tr>\r\n";
echo "</table>\r\n";
} elseif ($step == 2) { //论坛基本设置
$sql = "SELECT * FROM {$bbsxp_tblpre}SiteSettings";
$rs=$dbc->execute($sql);
$fieldarray = array(
'sitename' => 'SiteName',
'siteurl' => 'SiteURL',
'bbclosed' => 'SiteDisabled',
'seodescription' => 'metaDescription',
'seokeywords' => 'metaKeywords',
'topicperpage' => 'ThreadsPerPage',
'postperpage' => 'PostsPerPage',
'oltimespan' => 'UserOnlineTime',
'whosonlinestatus' => 'DisplayWhoIsOnline',
'floodctrl' => 'DuplicatePostIntervalInMinutes',
'newbiespan' => 'RegUserTimePost',
'hottopic' => 'PopularPostThresholdPosts',
'censoruser' => 'BannedRegUserName',
'doublee' => 'OnlyMailReg',
'regstatus' => 'CloseRegUser',
'regverify' => 'EnableUser',
'bbrulestxt' => 'RegUserAgreement',
);
while (!$rs->EOF) {
foreach($fieldarray AS $key => $val) {
$setting[$key] = $rs->fields[$val]->value;
$setting['regstatus'] = $setting['regstatus'] == 1 ? 0 : 1;
$sql = "REPLACE INTO {$dz_tblpre}settings (variable, value) VALUES ('$key', '$setting[$key]')";
if (@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog("导入论坛基本设置数据出错:$key => $setting[$key],语句:<br>$sql".mysqlerror());
}
$totalrows++;
}
$rs->movenext();
}
$rs->close();
report('论坛基本设置');
stay_redirect();
} elseif ($step == 3) { //会员
if($start <= 1) {
mysql_query("TRUNCATE TABLE {$dz_tblpre}members ") or dexit("清空会员表出错");
mysql_query("TRUNCATE TABLE {$dz_tblpre}memberfields") or dexit("清空会员信息表出错");
$sql = "SELECT MIN(id) AS minid, MAX(id) AS maxid FROM {$bbsxp_tblpre}users";
$rs=$dbc->execute($sql);
if (!$rs->EOF) {
$start = $rs->fields[minid]->value;
$maxid = $rs->fields[maxid]->value;
}
$rs->close();
$start = $start > 1 ? $start : 1;
$end = $start + $rpp - 1;
}
$sql = "SELECT * FROM {$bbsxp_tblpre}users WHERE (ID BETWEEN $start AND $end)";
$rs=$dbc->execute($sql);
$fieldarray = array('id', 'username', 'userpass', 'userroleid', 'useraccountstatus', 'usermail', 'userhome', 'userhonor', 'usersex', 'birthday', 'posttopic', 'postrevert', 'goodtopic', 'usermoney', 'savemoney', 'experience', 'userface', 'userlastip', 'userlandtime', 'userregtime', 'usersign', 'userinfo', 'userim');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$user[$field] = $rs->fields[$field]->value;
}
$_username = trim($user['username']);
$_uid = $user['id'];
if(!$_username || $_username != htmlspecialchars(daddslashes($user['username']))) {
reportlog("非法用户名 <b><font color='red'>$_username</font></b> 不能被转换,uid = $_uid;<br>\r\n");
} elseif(strlen($_username) > 15) {
reportlog("用户名 <b><font color='orange'>$_username</font></b> 长度大于 15,不能被转换,uid = $_uid;<br>\r\n");
} else {
$user = daddslashes($user);
$user_site = '';
if ($user['userhome'] && strtolower($user['userhome']) != 'http://') {
$user_site = trim(preg_match("/^https?:\/\/.+/i", $user['userhome']) ? $user['userhome'] : ($user['userhome'] ? 'http://'.$user['userhome'] : ''));
$user_site = $user_site ? htmlspecialchars($user_site) : '';
$user_site = $user_site ? cutstr($user_site,75) : '';
}
$user_signature = trim($user['sign']);
$user_signature_code = '';
$user_signature_html = '';
$user_sigstatus = 0;
if($user['sign']) {
$user_signature_code = @strip_tags($user_signature);
$user_signature_html = $user_signature;
$user_sigstatus = 1;
}
$userimArray = explode("\\",$user['userim']);
$userinfoArray = explode("\\",$user['userinfo']);
$user['icq'] = trim($userimArray[1]);
$user['qq'] = trim($userimArray[0]);
$user['yahoo'] = trim($userimArray[4]);
$user['msn'] = trim($userimArray[3]);
$user_avatar = '';
$user_avatarwidth = 0;
$user_avatarheight = 0;
if (!empty($user['userface'])) {
if (strtolower(substr($user['userface'], 0, 6) ) == 'images') {
$user_avatar = $user['userface'];
$user_avatarwidth = '100';
$user_avatarheight = '100';
}
}
$uid = $_uid;
$username = $_username;
$password = strtolower($user['userpass']);
$secques = '';
$gender = ($user['sex'] == 'male') ? 1 : (($user['sex'] == 'female') ? 2 : 0);
$adminid = 0;
$groupid = $user['useraccountstatus'] == 1 ? 10 : 8;
if(in_array($user['userroleid'], array(1,2))) {
$groupid = $adminid = $user['userroleid'];
}
$groupexpiry = 0;
$extgroupids = '';
$regip = 'bbsxp';
$regdate = timeconv($user['userregtime']);
$lastip = $user['userlastip'] ? $user['userlastip'] : 'bbsxp';
$lastvisit = timeconv($user['userlandtime']);
$lastactivity = $lastvisit;
$lastpost = $lastvisit;
$posts = $user['posttopic'] + $user['postrevert'];
$digestposts = $user['goodtopic'];
$oltime = 0;
$pageviews = 0;
$credits = $user['experience'];
$extcredits1 = $user['usermoney'] + $user['savemoney'];
$extcredits2 = 0;
$extcredits3 = 0;
$extcredits4 = 0;
$extcredits5 = 0;
$extcredits6 = 0;
$extcredits7 = 0;
$extcredits8 = 0;
$avatarshowid = 0;
$email = cutstr($user['usermail'], 50);
$bday = $user['birthday'] ? date('Y-m-d', $user['birthday']) : '';
$sigstatus = $user_sigstatus;
$tpp = 0;
$ppp = 0;
$styleid = 0;
$dateformat = 0;
$timeformat = 0;
$pmsound = 0;
$showemail = 0;
$newsletter = 1;
$invisible = 0;
$timeoffset = 9999;
$newpm = 0;
$accessmasks = 0;
$nickname = '';
$site = $user_site;
$alipay = '';
$icq = $user['icq'] ? (preg_match("/^([0-9]+)$/", $user['icq']) && strlen($user['icq']) >= 5 && strlen($user['icq']) <= 12 ? $user['icq'] : '') : '';
$qq = $user['qq'] ? (preg_match("/^([0-9]+)$/", $user['qq']) && strlen($user['qq']) >= 5 && strlen($user['qq']) <= 12 ? $user['qq'] : '') : '';
$yahoo = $user['yahoo'] ? htmlspecialchars(cutstr($user['yahoo'], 40)) : '';
$msn = $user['msn'] ? htmlspecialchars(cutstr($user['msn'], 40)) : '';
$taobao = '';
$location = $userinfoArray[2] ? cutstr(htmlspecialchars(trim(strip_tags($userinfoArray[2]))), 30) : '';
$customstatus = $user['userhonor'] ? cutstr(htmlspecialchars(trim(strip_tags($user['userhonor']))), 30) : '';
$medals = '';
$avatar = $user_avatar;
$avatarwidth = $user_avatarwidth;
$avatarheight = $user_avatarheight;
$bio = $userinfoArray[14] ? cutstr(htmlspecialchars($userinfoArray[14]), 100) : '';
$signature = $user_signature_code;
$sightml = $user_signature_html;
$ignorepm = '';
$groupterms = '';
$authstr = '';
$query1 = "INSERT INTO {$dz_tblpre}members (uid,username, password, secques, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, posts, credits, extcredits1, extcredits2, extcredits3, extcredits4, extcredits5, extcredits6, extcredits7, extcredits8, email, bday, sigstatus, tpp, ppp, styleid, dateformat, timeformat, pmsound, showemail, newsletter, invisible, timeoffset, lastpost, lastip) VALUES
('$uid','$username', '$password', '$secques', '$gender', '$adminid', '$groupid', '$regip', '$regdate', '$lastvisit', '$lastactivity', '$posts', '$credits','$extcredits1', '$extcredits2', '$extcredits3', '$extcredits4', '$extcredits5', '$extcredits6', '$extcredits7', '$extcredits8', '$email', '$bday', '$sigstatus', '$tpp', '$ppp', '$styleid', '$dateformat', '$timeformat', '$pmsound', '$showemail', '$newsletter', '$invisible', '$timeoffset','$lastpost','$lastip');";
$query2 = "INSERT INTO `{$dz_tblpre}memberfields`(uid, nickname, site, icq, qq, yahoo, msn, taobao, location, customstatus, medals, avatar, avatarwidth, avatarheight, bio, signature, sightml,ignorepm, groupterms,authstr) VALUES
('$uid', '$nickname', '$site', '$icq', '$qq', '$yahoo', '$msn', '' ,'$location', '$customstatus', '', '$davatar', '$davatarwidth', '$davatarheight','$bio', '$signature', '$sightml', '$ignorepm','$groupterms', '$authstr');";
if (@mysql_query($query1)) {
if (@mysql_query($query2)) {
$convertedrows ++;
} else {
@mysql_query("DELETE FROM `{$dz_tblpre}members` WHERE `uid`='$uid' LIMIT 1;");
reportlog("<hr>插入会员扩展信息数据出错 uid = $uid username = $username 数据表: ".$dz_tblpre."memberfields<br>\r\n语句: $query2<br><br>\r\n");
}
} else {
reportlog("<hr>插入会员基本数据出错 uid = $uid username = $username 数据表: ".$dz_tblpre."members<br>\r\n语句: $query1<br><br>\r\n");
}
}
$converted = 1;
$totalrows ++;
$rs->movenext();
}
$rs->close();
if($converted || $end < $maxid) {
continue_redirect();
} else {
mysql_query("ALTER TABLE `$dz_tblpre"."members` ORDER BY `uid` ASC") or reportlog('整理用户表数据错误!'.mysqlerror());
mysql_query("ALTER TABLE `$dz_tblpre"."memberfields` ORDER BY `uid` ASC") or reportlog('整理用户个性信息表错误!'.mysqlerror());
report('会员');
stay_redirect();
}
} elseif ($step == 4) { //版区
mysql_query("TRUNCATE TABLE {$dz_tblpre}forums") or dexit("清空版区表有误");
mysql_query("TRUNCATE TABLE {$dz_tblpre}forumfields") or dexit("清空版区信息有误");
mysql_query("TRUNCATE TABLE {$dz_tblpre}moderators") or dexit("清空斑竹信息有误");
$sql = "SELECT * FROM {$bbsxp_tblpre}Forums";
$rs=$dbc->execute($sql);
$fieldarray = array('id', 'followid', 'sortnum', 'forumname', 'moderated', 'tolspecialtopic', 'forumintro', 'forumtoday', 'forumthreads', 'forumposts', 'forumlogo', 'forumicon', 'forumhide', 'lasttopic', 'lastname', 'lasttime', 'forumrules', 'ismoderated');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$forum[$field] = daddslashes($rs->fields[$field]->value);
}
$fid = $forum['id'];
$fup = 0;
$type = 'forum';
$name = @strip_tags($forum['forumname']);
$description = @strip_tags($forum['forumintro']);
$status = $forum['forumhide'] ? 0 : 1;
$displayorder = $forum['sortnum'];
$styleid = 0;
$threads = $forum['forumthreads'];
$posts = $forum['forumposts'];
$lastpost = '';
$todayposts = $forum['forumtoday'];
$allowsmilies = 1;
$allowhtml = 0;
$allowbbcode = 1;
$allowimgcode = 1;
$allowblog = 1;
$recyclebin = 1;
$modnewposts = 0;
$inheritedmod = 0;
$postcredits = '-1';
$replycredits = '-1';
$jammer = 0;
$autoclose = 0;
$postcredits = '';
$replycredits = '';
$password = '';
$icon = $forum['forumicon'];
$redirect = '';
$attachextensions = '';
$moderatorlist = explode('|', $forum['moderated']);
$forum_moderators = '';
if(is_array($moderatorlist)) {
foreach ($moderatorlist AS $mkey => $mUsername) {
$mquery = @mysql_query("SELECT uid, username FROM {$dz_tblpre}members WHERE username='$mUsername' LIMIT 1;");
if ($mquery) {
$muser = mysql_fetch_array($mquery, MYSQL_ASSOC);
if($muser['uid']) {
mysql_query("INSERT INTO {$dz_tblpre}moderators (uid, fid, displayorder, inherited) VALUE ('$muser[uid]', '$_fid', '0', '0');");
mysql_query("UPDATE {$dz_tblpre}members SET adminid='3', groupid='3' WHERE uid='$muser[uid]' AND adminid='0' LIMIT 1;");
$forum_moderators .= $mUsername."\t";
}
}
}
}
$forum_moderators = trim($forum_moderators);
$moderators = $forum_moderators;
$rules = $forum['forumrules'];
$viewperm = '';
$postperm = '';
$replyperm = '';
$getattachperm = '';
$postattachperm = '';
$threadtypes = '';
$sql = "INSERT INTO `$dz_tblpre"."forums` ( `fid` , `fup` , `type` , `name` , `status` , `displayorder` , `styleid` , `threads` , `posts` ,`todayposts`, `lastpost` , `allowsmilies` , `allowhtml` , `allowbbcode` , `allowimgcode` , `allowblog` ,`allowtrade`, `recyclebin` , `modnewposts` , `jammer`,`inheritedmod` , `autoclose` )
VALUES ('$fid', '$fup', '$type', '$name', '$status', '$displayorder', '$styleid', '$threads', '$posts', '$todayposts','$lastpost', '$allowsmilies', '$allowhtml', '$allowbbcode', '$allowimgcode', '$allowblog','0', '$recyclebin', '$modnewposts', '$jammer','$inheritedmod', '$autoclose');";
$sql2 = "INSERT INTO `$dz_tblpre"."forumfields` ( `fid` ,`description`, `password` , `icon` , `postcredits`,`replycredits`,`redirect` , `attachextensions` , `moderators` , `rules` ,`threadtypes`, `viewperm` , `postperm` , `replyperm` , `getattachperm` , `postattachperm` )
VALUES ('$fid', '$description', '$password', '$icon', '$postcredits','$replycredits','$redirect', '$attachextensions', '$moderators', '$rules', '$threadtypes','$viewperm', '$postperm', '$replyperm', '$getattachperm', '$postattachperm');";
if (mysql_query($sql)) {
if (mysql_query($sql2)) {
$convertedrows ++;
} else {
mysql_query("DELETE FROM `{$dz_tblpre}forums` WHERE `fid`='$fid' LIMIT 1;");
reportlog("<hr>插入版区扩展信息数据出错 fid = $fid name = $name 数据表: ".$dz_tblpre."forumfields<br>\r\n语句: $query2<br><br>\r\n");
}
} else {
reportlog("<hr>插入版区基本数据出错 fid = $fid name = $name 数据表: ".$dz_tblpre."forums<br>\r\n语句: $query1<br><br>\r\n");
}
$totalrows ++;
$rs->Movenext();
}
$rs->close();
mysql_query("ALTER TABLE {$dz_tblpre}forums ORDER BY `fid` ASC") or reportlog('整理 forums 表错误!'.mysqlerror());
mysql_query("ALTER TABLE {$dz_tblpre}forumfields ORDER BY `fid` ASC") or reportlog('整理 forumfields 表错误!'.mysqlerror());
mysql_query("ALTER TABLE {$dz_tblpre}moderators ORDER BY `uid` ASC") or reportlog('整理 moderators 表错误!'.mysqlerror());
report('版区');
stay_redirect();
} elseif ($step == 5) { //主题
if($start <= 1) {
mysql_query("TRUNCATE TABLE {$dz_tblpre}threads") or dexit("清空主题表有误");
$sql = "SELECT MIN(id) AS minid, MAX(id) AS maxid FROM {$bbsxp_tblpre}Threads";
$rs=$dbc->execute($sql);
if (!$rs->EOF) {
$start = $rs->fields[minid]->value;
$maxid = $rs->fields[maxid]->value;
}
$rs->close();
$start = $start > 1 ? $start : 1;
$end = $start + $rpp - 1;
}
$query = "SELECT * FROM {$bbsxp_tblpre}Threads WHERE id BETWEEN $start AND $end";
$rs=$dbc->execute($query);
$fieldarray = array('id', 'forumid', 'icon', 'topic', 'username', 'lastname', 'posttime', 'lasttime', 'isgood', 'istop', 'islocked', 'isdel', 'isvote', 'views', 'replies');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$t[$field] = daddslashes($rs->fields[$field]->value);
}
$tid = $t['id'];
$fid = $t['forumid'];
$iconid = 0;
$typeid = 0;
$readperm = 0;
$price = 0;
$author = cutstr(htmlspecialchars(trim($t['username'])),15);
$authorid = 0;
$subject = cutstr(htmlspecialchars(trim(@strip_tags($t['topic']))),78);
$dateline = timeconv($t['posttime']);
$lastpost = timeconv($t['lasttime']);
$lastposter = cutstr(htmlspecialchars(trim($t['lastname'])), 15);
$views = $t['views'];
$replies = $t['replies'];
$displayorder = $t['isdel'] ? '-1' : ($t['istop'] > 3 ? 3 : $t['istop']);
$highlight = 0;
$digest = $t['isgood'] > 3 ? 3 : $t['isgood'];
$rate = 0;
$blog = 0;
$poll = 0;
$attachment = '';
$subscribed = 0;
$moderated = '';
$closed = $t['islocked'];
$sql = "INSERT INTO `$dz_tblpre"."threads` (
`tid` , `fid` , `iconid` , `typeid`, `readperm`, `price`,`author` , `authorid` , `subject` , `dateline` , `lastpost` , `lastposter` , `views` , `replies` , `displayorder` , `highlight` , `digest` , `rate` , `blog` , `poll` , `attachment` , `subscribed`, `moderated` , `closed`
) VALUES(
'$tid','$fid', '$iconid', '0', '0', '0', '$author', '$authorid','$subject','$dateline','$lastpost','$lastposter','$views','$replies','$displayorder','$highlight','$digest','$rate','$blog','$poll','$attachment','$subscribed','$moderated','$closed');";
if(@mysql_query($sql)){
$convertedrows ++;
} else {
reportlog("无法转换主题 tid = $tid subject = '$subject',SQL 语句如下 :<br><textarea rows=\"3\" style=\"width: 100%;\">".$sql."</textarea>".mysqlerror());
}
$converted = 1;
$totalrows ++;
$rs->Movenext();
}
$rs->close();
if($converted || $end < $maxid) {
continue_redirect();
} else {
mysql_query("ALTER TABLE {$dz_tblpre}threads ORDER BY 'tid' ASC;") or reportlog('整理threads数据表错误'.mysqlerror());
report('主题');
stay_redirect();
}
} elseif ($step == 6) { //帖子
$tableid = isset($_GET['tableid']) ? $_GET['tableid'] : 0;
$tablearray = explode(',', str_replace(' ', '', $bbsxp_posttbl));
$tablecount = count($tablearray);
$tableid = intval($tableid);
$posttable = $tablearray[$tableid];
if($start <= 1 && $tableid == 0) {
mysql_query("TRUNCATE TABLE {$dz_tblpre}posts") or dexit("清空帖子表错误".mysqlerror());
$sql = "SELECT MIN(id) AS minid, MAX(id) AS maxid FROM $tablearray[0]";
$rs=$dbc->execute($sql);
if (!$rs->EOF) {
$start = $rs->fields[minid]->value;
$maxid = $rs->fields[maxid]->value;
}
$rs->close();
$start = $start > 1 ? $start : 1;
$end = $start + $rpp - 1;
}
$sql = "SELECT * FROM $posttable WHERE (id BETWEEN $start AND $end)";
$rs = $dbc->execute($sql);
$fieldarray = array('id', 'threadid', 'istopic', 'username', 'subject', 'content', 'postip', 'posttime');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$p[$field] = daddslashes($rs->fields[$field]->value);
}
$p[first] = $p[istopic];
$p['subject'] = cutstr(@strip_tags(trim($p['subject'])),78);
$p[author] = $p[username];
$p['dateline'] = timeconv($p['posttime']);
$p['message'] = $p['content'];
$attachment = 0;
$htmlon = 1;
$sql="INSERT INTO {$dz_tblpre}posts (pid, fid, tid, first, author, authorid, subject, dateline, message, useip, attachment,usesig, bbcodeoff, smileyoff, parseurloff, htmlon, rate, ratetimes) ".
"VALUES ('$p[id]', '0', '$p[threadid]', '$p[first]', '$p[author]', '0', '$posts[subject]', '$p[dateline]', '$p[message]', '$p[postip]', '$attachment','0', '0', '0', '0', '$htmlon', '0', '0')";
if(@mysql_query($sql)){
$convertedrows ++;
} else {
reportlog("无法转换帖子 pid = $p[pid] subject = '$p[subject]',SQL 语句如下 :<br><textarea rows=\"3\" style=\"width: 100%;\">".$sql."</textarea>".mysqlerror());
}
$converted =1;
$totalrows ++;
$rs->movenext();
}
$rs->Close();
if($converted || $end < $maxid) {
continue_redirect("&tableid=$tableid");
} elseif($tableid < $tablecount - 1) {
$nextid = $tableid + 1;
$sql = "SELECT MIN(id) AS minid, MAX(id) AS maxid FROM $tablearray[$nextid]";
$rs = $dbc->execute($sql);
if (!$rs->EOF) {
$start = $rs->fields[minid]->value;
$maxid = $rs->fields[maxid]->value;
}
$rs->close();
$start = $start > 1 ? $start : 1;
$end = $start - 1;
continue_redirect("&tableid=$nextid");
} else {
report('帖子');
stay_redirect();
}
} elseif ($step == 7) { //主题作者 uid 对应关系
$query = mysql_query("SELECT tid FROM {$dz_tblpre}threads LIMIT $limit_start, $rpp");
while($t = mysql_fetch_array($query)) {
$sql = "UPDATE {$dz_tblpre}threads t, {$dz_tblpre}members m SET t.authorid=m.uid WHERE t.tid='$t[tid]' AND t.author=m.username";
if (@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog(mysqlerror());
}
$converted = 1;
$totalrows ++;
}
if($converted) {
continue_redirect();
} else {
report('主题作者 uid 对应关系');
stay_redirect();
}
} elseif ($step == 8) { //帖子作者 uid 对应关系
$query = mysql_query("SELECT pid FROM {$dz_tblpre}posts LIMIT $limit_start, $rpp");
while($p = mysql_fetch_array($query)) {
$sql = "UPDATE {$dz_tblpre}posts p, {$dz_tblpre}members m SET p.authorid=m.uid WHERE p.pid='$p[pid]' AND p.author=m.username";
if (@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog(mysqlerror());
}
$converted = 1;
$totalrows ++;
}
if($converted) {
continue_redirect();
} else {
report('帖子作者 uid 对应关系');
stay_redirect();
}
} elseif ($step == 9) { //帖子所在版块 fid 对应关系
$query = mysql_query("SELECT pid FROM {$dz_tblpre}posts LIMIT $limit_start, $rpp");
while($p = mysql_fetch_array($query)) {
$sql = "UPDATE {$dz_tblpre}posts p, {$dz_tblpre}threads t SET p.fid=t.fid WHERE p.pid='$p[pid]' AND p.tid=t.tid";
if (@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog(mysqlerror());
}
$converted = 1;
$totalrows ++;
}
if($converted) {
continue_redirect();
} else {
report('帖子所在版块 fid 对应关系');
stay_redirect();
}
} elseif ($step == 10) { //短消息数据
if($start <= 1) {
mysql_query("TRUNCATE TABLE {$dz_tblpre}pms") or dexit('清空短消息表错误!');
$sql = "SELECT MIN(id) AS minid, MAX(id) AS maxid FROM {$bbsxp_tblpre}Messages";
$rs=$dbc->execute($sql);
if (!$rs->EOF) {
$start = $rs->fields[minid]->value;
$maxid = $rs->fields[maxid]->value;
}
$rs->close();
$start = $start > 1 ? $start : 1;
$end = $start + $rpp - 1;
}
$query = "SELECT * FROM {$bbsxp_tblpre}Messages WHERE id BETWEEN $start AND $end";
$rs =$dbc->execute($query);
$fieldarray = array('id', 'username', 'incept', 'content', 'datecreated', 'parentid', 'ispublish');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$m[$field] = daddslashes($rs->fields[$field]->value);
}
$msgtoid = getuid($m['incept']);
//if($msgtoid == 0) {
//reportlog("不存在的接收者:$m[incept] 短消息不予转换;");
//} else {
if($msgtoid > 0) {
$msgfrom = $m['username'];
$msgfromid = getuid($m['username']);
$subject = 'No subject';
$dateline = timeconv($m['datecreated']);
$dateline = $dateline > $timestamp ? $timestamp : $dateline;
$message = @strip_tags(trim($m['content']));
$sql = "INSERT INTO `$dz_tblpre"."pms` (`msgfrom` , `msgfromid` , `msgtoid` , `folder` , `new` , `subject` , `dateline` , `message` ) VALUES ('$msgfrom', '$msgfromid', '$msgtoid', 'inbox', '0', '$subject', '$dateline', '$message');";
if(@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog("无法转换短消息 $subject <br>".$sql."<br>".mysqlerror());
}
$totalrows ++;
}
$converted = 1;
$rs->Movenext();
}
$rs->close();
if($converted || $end < $maxid) {
continue_redirect();
} else {
report('短消息');
stay_redirect();
}
} elseif ($step == 11) { //公告数据
if($start <= 1) {
mysql_query("TRUNCATE TABLE {$dz_tblpre}announcements") or dexit('清空公告表错误!');
}
$query = "SELECT * FROM {$bbsxp_tblpre}Affiche";
$rs = $dbc->execute($query);
$fieldarray = array('id', 'title', 'content', 'username', 'posttime');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$a[$field] = daddslashes($rs->fields[$field]->value);
}
$a[posttime] = timeconv($a[posttime]);
$sql = "INSERT INTO {$dz_tblpre}announcements (`id` , `author` , `subject` , `starttime` , `message` ) VALUES ('$a[id]', '$a[username]', '$a[title]', '$a[posttime]', '$a[message]');";
if(@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog(mysqlerror());
}
$totalrows ++;
$converted = 1;
$rs->Movenext();
}
$rs->close();
report('公告');
stay_redirect();
} elseif ($step == 12) { //联盟论坛数据
if($start <= 1) {
mysql_query("TRUNCATE TABLE `$dz_tblpre"."forumlinks`") or dexit('清空联盟论坛表错误!');
}
$query = "SELECT * FROM {$bbsxp_tblpre}Link ORDER BY id";
$rs=$dbc->execute($query);
$fieldarray = array('id', 'name', 'url', 'logo', 'intro');
while (!$rs->EOF) {
foreach($fieldarray AS $field) {
$forumlink[$field] = daddslashes($rs->fields[$field]->value);
}
$forumlink['name'] = cutstr(@strip_tags(trim($forumlink['name'])),100);
$forumlink['url'] = cutstr(@strip_tags(trim($forumlink['url'])),100);
$forumlink['note'] = cutstr(@strip_tags(trim($forumlink['intro'])),200);
$forumlink['logo'] = cutstr(@strip_tags(trim($forumlink['logo'])),100);
$sql = "INSERT INTO `$dz_tblpre"."forumlinks` (`name` , `url` , `note` , `logo` ) VALUES ('$name', '$forumlink[url]', '$forumlink[note]', '$forumlink[logo]');";
;
if(@mysql_query($sql)) {
$convertedrows ++;
} else {
reportlog("无法转换联盟论坛 $name <br>".$sql."<br>".mysqlerror());
}
$totalrows ++;
$rs->Movenext();
}
$rs->close();
@mysql_query("ALTER TABLE `$dz_tblpre"."forumlinks` ORDER BY `id` ASC") or reportlog('整理 forumlinks 数据表错误'.mysqlerror());
report('联盟论坛');
stay_redirect();
} else { //结束转换
echo "<br><center><b><span style='font-size:16px'>$source_ver 转换 $discuz_ver 完毕! <a href=\"./$reportfile\" target=\"_blank\"><u>查看转换结果分析报告 $reportfile</u></a></span></b></center><br>\r\n";
echo "<font size=4 color=red>请将 bbsxp 的附件目录 UpFile 及其下的所有文件及目录移至 discuz 根目录下;<br>请用您的管理员帐号登陆论坛后台执行:<br>更新论坛统计 <br> 更新缓存</font> <hr>";
echo " <b>如果重新转换请选择转换进程:</b> <br>\r\n";
echo " <div style='padding-left:90px;line-height:150%;'>\r\n";
echo " <li>[<a href='".$scriptname."'>返回到程序首页</a>]</li>\r\n";
echo " <li>[<a href='".$scriptname."?step=2'><b>重新开始完全转换</b></a>]</li>\r\n";
echo " <br><b>注:以下为分步单独转换,执行完所进行操作后程序不会自动进入下一步转换操作.</b><br>\r\n";
foreach ($action AS $astep=>$aaction) {
if ($astep != 1) {
echo " <li>单独[<a href='".$scriptname."?step=".$astep."&stay=1'>$aaction</a>]</li>\r\n";
}
}
echo " </div>\r\n";
}
echo dfooter();
#################### 函数定义 ############################
function stay_redirect() {
global $action, $actionnow, $scriptname, $step, $stay, $reportfile;
$nextstep = $step + 1;
if ($stay) {
$actions = isset($action[$nextstep]) ? $action[$nextstep] : '结束';
echo "$actionnow 操作完毕.".($stay == 1 ? " <a href=\"./$reportfile\" target=\"_blank\"><u>查看转换结果分析报告 $reportfile</u></a>" : '').'<br>';
echo "<a href='".$scriptname."?step=".$nextstep."&stay=1'>如果继续下一步操作( $actions ),请点击这里</a><br>";
echo "<a href='$scriptname'>点击这里返回到程序首页</a>";
} else {
if (isset($action[$nextstep])) {
echo "即将进入".$action[$nextstep].".<br>";
}
echo "<script>\r\n";
echo "<!--\r\n";
echo "function redirect() {\r\n";
echo " window.location.replace('".$scriptname."?step=".$nextstep."');\r\n";
echo "}\r\n";
echo "setTimeout('redirect();', 2000);\r\n";
echo "-->\r\n";
echo "</script>\r\n";
echo "<p align=right>[<a href='$scriptname' style='color:red'>停止运行</a>]<br><br><a href=\"".$scriptname."?step=".$nextstep."\">如果您的浏览器没有自动跳转,请点击这里</a></p>";
}
}
function continue_redirect() {
global $scriptname, $step, $end, $stay, $convertedrows, $totalrows, $maxid;
$url = $scriptname."?step=$step&start=".($end + 1)."&stay=$stay&totalrows=$totalrows&convertedrows=$convertedrows&maxid=$maxid";
echo "<script>\r\n";
echo "<!--\r\n";
echo "function redirect() {\r\n";
echo " window.location.replace('".$url."');\r\n";
echo "}\r\n";
echo "setTimeout('redirect();', 2000);\r\n";
echo "-->\r\n";
echo "</script>\r\n";
echo "<p align=right>[<a href='$scriptname' style='color:red'>停止运行</a>]<br><br><a href=\"".$url."\">如果您的浏览器没有自动跳转,请点击这里</a></p>";
}
function daddslashes($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = daddslashes($val);
}
} else {
$string = addslashes($string);
}
return $string;
}
function cutstr($string, $length) {
$wordscut = '';
if(strlen($string) > $length) {
for($i = 0; $i < $length - 3; $i++) {
if(ord($string[$i]) > 127) {
$wordscut .= $string[$i].$string[$i + 1];
$i++;
} else {
$wordscut .= $string[$i];
}
}
return $wordscut;
}
return $string;
}
function getuid($username = '') {
if ($username) {
$query = @mysql_query("SELECT `uid` FROM `{$GLOBALS['dz_tblpre']}members` WHERE `username`='$username' LIMIT 1;");
return @mysql_result($query,0);
}
return 0;
}
function adodbClose() {
global $rs, $dbc;
if($dbc) {
@$dbc->Close();
$dbc->Release();
}
$rs = $dbc = NULL;
}
function dheader() {
global $step, $steps, $actionnow, $source_ver, $discuz_ver, $scriptname;
return "
<html>
<head>
<title>第 $step/".($steps + 1)." 步($actionnow) - $source_ver 转换 $discuz_ver</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gbk\">
<style>
A:visited {COLOR: #3A4273; TEXT-DECORATION: none}
A:link {COLOR: #3A4273; TEXT-DECORATION: none}
A:hover {COLOR: #3A4273; TEXT-DECORATION: underline}
body,table,td {COLOR: #3A4273; FONT-FAMILY: Tahoma, Verdana, Arial; FONT-SIZE: 12px; LINE-HEIGHT: 20px; scrollbar-base-color: #E3E3EA; scrollbar-arrow-color: #5C5C8D}
input {COLOR: #085878; FONT-FAMILY: Tahoma, Verdana, Arial; FONT-SIZE: 12px; background-color: #3A4273; color: #FFFFFF; scrollbar-base-color: #E3E3EA; scrollbar-arrow-color: #5C5C8D}
.install {FONT-FAMILY: Arial, Verdana; FONT-SIZE: 20px; FONT-WEIGHT: bold; COLOR: #000000}
</style>
</head>
<body bgcolor=\"#3A4273\" text=\"#000000\">
<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" align=\"center\">
<tr>
<td>
<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td class=\"install\" height=\"30\" valign=\"bottom\"><font color=\"#FF0000\">>></font>
<b><span style='font-size:14px'>$source_ver 转换 $discuz_ver 程序 $scriptname</span></b></td>
</tr>
<tr>
<td>
<hr noshade align=\"center\" width=\"100%\" size=\"1\">
</td>
</tr>
<tr>
<td align=\"center\">
<b><span style='color:#FF58C0'>本程序基于 $source_ver 数据转换而设计,<u>也可能</u>用于稍高或者稍低版本的转换</span></b>
</td>
</tr>
<tr>
<td>
<hr noshade align=\"center\" width=\"100%\" size=\"1\">
</td>
</tr>
<tr>
<td>
";
}
function dfooter() {
return "
</td>
</tr>
<tr>
<td>
<hr noshade align=\"center\" width=\"100%\" size=\"1\">
</td>
</tr>
<tr>
<td align=\"center\">
<b style=\"font-size: 11px\">Powered by <a href=\"https://discuz.dismall.com\" target=\"_blank\">Discuz! <?=$version?></a> , Copyright © <a href=\"http://www.comsenz.com\" target=\"_blank\">Comsenz Technology Ltd</a>, 2001-2005</b>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</body>
</html>
";
}
function mysqlerror() {
$mysqlerrno = mysql_errno();
switch($mysqlerrno) {
case '1005': $errmsg = "创建表失败"; break;
case '1006': $errmsg = "创建数据库失败"; break;
case '1007': $errmsg = "数据库已存在,创建数据库失败"; break;
case '1008': $errmsg = "数据库不存在,删除数据库失败"; break;
case '1016': $errmsg = "无法打开数据文件"; break;
case '1041': $errmsg = "系统内存不足"; break;
case '1045': $errmsg = "连接数据库失败,用户名或密码错误"; break;
case '1044': $errmsg = "当前用户没有访问数据库的权限"; break;
case '1048': $errmsg = "字段不能为空"; break;
case '1049': $errmsg = "数据库不存在"; break;
case '1050': $errmsg = "数据表已存在"; break;
case '1051': $errmsg = "数据表不存在"; break;
case '1054': $errmsg = "字段不存在"; break;
case '1062': $errmsg = "字段值重复,入库失败"; break;
case '1064': $errmsg = "可能原因:1.数据超长或类型不匹配;2.数据库记录重复"; break;
case '1065': $errmsg = "无效的SQL语句,SQL语句为空"; break;
case '1081': $errmsg = "不能建立Socket连接"; break;
case '1129': $errmsg = "数据库出现异常,请重启数据库"; break;
case '1130': $errmsg = "连接数据库失败,没有连接数据库的权限"; break;
case '1133': $errmsg = "数据库用户不存在"; break;
case '1141': $errmsg = "当前用户无权访问数据库"; break;
case '1142': $errmsg = "当前用户无权访问数据表"; break;
case '1143': $errmsg = "当前用户无权访问数据表中的字段"; break;
case '1146': $errmsg = "数据表不存在"; break;
case '1149': $errmsg = "SQL语句语法错误"; break;
case '1169': $errmsg = "字段值重复,更新记录失败"; break;
case '2003': $errmsg = "请检查数据库服务器端口设置是否正确,默认端口为 3306"; break;
case '2005': $errmsg = "数据库服务器不存在"; break;
}
return $mysqlerrno ? '<br>Error '.$mysqlerrno.' : '.mysql_error().'.<br>错误 '.$mysqlerrno.':'.$errmsg.'。<br>' : '';
}
function dexit($msg = '', $sql = 'mysql') {
if($sql == 'mysql') {
exit('<tr><td>'.$msg.mysqlerror().'</td></tr>'.dfooter());
} elseif($sql == 'access') {
exit('<tr><td>'.$msg.'</td></tr>'.dfooter());
}
}
function timeconv($time) {
return strtotime(str_replace(array(' 一月 ',' 二月 ',' 三月 ',' 四月 ',' 五月 ',' 六月 ',' 七月 ',' 八月 ',' 九月 ',' 十月 ',' 十一月 ',' 十二月 '), array('-1-','-2-','-3-','-4-','-5-','-6-','-7-','-8-','-9-','-10-','-11-','-12-'), $time));
}
function reportlog($report) {
global $reportfile;
$fp = @fopen($reportfile, 'a');
@fwrite($fp, $report."<br>\r\n");
@fclose($fp);
}
function report($data) {
global $convertedrows, $totalrows, $step;
reportlog("\r\n<br>结果分析:共有 $data 数据 <font color='blue'>$totalrows</font> 条,转换成功 <font color='grey'>$convertedrows</font> 条,失败 <font color='gray'>".($totalrows - $convertedrows)."</font> 条,成功率:<font color='red'>".($totalrows > 0 ? $convertedrows / $totalrows * 100 : 0)."%</font>。<br>\r\n");
}
?> |