コード例 #1
0
//关闭连接
$conn->Close();
if (!file_exists($lbs_gbbook)) {
    echo "如想转换lbs留言板,请把留言数据文件默认放在data目录下面的" . $lbs_gbbook . "文件,请把它复制到tools下,请保证文件名也要一致!<br /><br />";
} else {
    $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($lbs_gbbook);
    $conn->Open($connstr);
    $rs = new com("ADODB.RecordSet", NULL, CP_UTF8);
    //转换留言板
    echo "正在转换留言板 ...";
    ob_flush();
    flush();
    $i = 0;
    $insert_value = array();
    $arr_fields = array("gb_username" => "author", "gb_ip" => "ip", "gb_postTime" => "postTime", "gb_content" => "content");
    $rs->Open("select * from Guestbook", $conn, 1, 1);
    while (!$rs->eof) {
        $insert_value[$i][id] = $i + 1;
        $insert_value[$i][parent] = 0;
        foreach ($arr_fields as $key => $value) {
            $f = $rs->Fields($key);
            $field_value = convert_quote($f->value);
            if ($key == "gb_postTime") {
                $field_value = lbstime_convert($field_value);
            }
            $insert_value[$i][$value] = $field_value;
        }
        //回复内容
        $reply_content = $rs->Fields("gb_reply")->value;
        if ($reply_content != "") {
            $i++;
コード例 #2
0
    exit;
}
include "../include/common.php";
echo "<font size=\"4\">转换pjblog的Access数据库到F2bLog,<br>正在运行,请不要关闭网页!</font><br /><br />";
$conn = new com("ADODB.Connection", NULL, CP_UTF8);
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($pjblog_data);
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet", NULL, CP_UTF8);
//转换类别
echo "正在转换类别 ...";
ob_flush();
flush();
$i = 0;
$insert_value = array();
$arr_fields = array("cate_ID" => "id", "cate_Name" => "name", "cate_Order" => "orderNo", "cate_Intro" => "cateTitle", "cate_count" => "cateCount", "cate_Secret" => "isHidden");
$rs->Open("select * from blog_Category", $conn, 1, 1);
while (!$rs->eof) {
    foreach ($arr_fields as $key => $value) {
        $f = $rs->Fields($key);
        $insert_value[$i][$value] = convert_quote($f->value);
    }
    $i++;
    $rs->MoveNext();
}
//print_r($insert_value);
$DMC->query("TRUNCATE TABLE " . $DBPrefix . "categories");
foreach ($insert_value as $value) {
    $key = array_keys($value);
    $insert_sql = "insert into " . $DBPrefix . "categories(" . implode(",", $key) . ") values('" . implode("','", $value) . "')";
    $DMC->query($insert_sql);
}
コード例 #3
0
    exit;
}
include "../include/common.php";
echo "<font size=\"4\">转换zblog的Access数据库到F2bLog,<br>正在运行,请不要关闭网页!</font><br /><br />";
$conn = new com("ADODB.Connection", NULL, CP_UTF8);
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($zblog_data);
$conn->Open($connstr);
$rs = new com("ADODB.RecordSet", NULL, CP_UTF8);
//转换类别
echo "正在转换类别 ...";
ob_flush();
flush();
$i = 0;
$insert_value = array();
$arr_fields = array("cate_ID" => "id", "cate_Name" => "name", "cate_Order" => "orderNo", "cate_Intro" => "cateTitle", "cate_Count" => "cateCount");
$rs->Open("select * from blog_Category", $conn, 1, 1);
while (!$rs->eof) {
    foreach ($arr_fields as $key => $value) {
        $f = $rs->Fields($key);
        $insert_value[$i][$value] = convert_quote($f->value);
    }
    $i++;
    $rs->MoveNext();
}
$DMC->query("TRUNCATE TABLE " . $DBPrefix . "categories");
foreach ($insert_value as $value) {
    $key = array_keys($value);
    $insert_sql = "insert into " . $DBPrefix . "categories(" . implode(",", $key) . ") values('" . implode("','", $value) . "')";
    $DMC->query($insert_sql);
}
echo " 共转换了<font color=red>" . $i . "</font>条记录<br /><br />";