<?php
//这是转换PE到DEDE3.1 或4.0的程序
//读取mdb数据库例程
set_time_limit(0);
$conn = new com("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=". realpath("aaa.mdb");
//打开MDB文件
$conn->Open($connstr);
//打开DEDEV3的数据库
echo "打开DEDE的数据库";
$rs = new com("ADODB.RecordSet");
$rs->Open("select * from PE_Class WHERE ClassID>0 ORDER BY ClassID ASC",$conn,1,1);
$conn2 = mysql_connect("localhost","root","1234") or die("MySQL链接错误!");
mysql_select_db("dedetest",$conn2);
mysql_query("SET NAMES GBK",$conn2);
echo "开始转换分类数据......<br />";
$i=0;
while(! $rs->eof) {
$id = $rs->Fields('ClassID')->value; //分类ID
$reid = $rs->Fields('parentid')->value; //分类父ID
$typename = $rs->Fields('ClassName')->value; //分类
$typedir = '{cmspath}/html'.$rs->Fields('ParentDir')->value.$rs->Fields('ClassDir')->value;//分类所存放的目录
if ($rs->Fields('ChannelID')->value == 1) {
$channeltype = 1;
$tempindex = '{style}/index_article.htm';
$templist = '{style}/list_article.htm';
$temparticle = '{style}/article_article.htm';
}
else if ($rs->Fields('ChannelID')->value == 2) {
$channeltype = 3;
$tempindex = '{style}/index_soft.htm';
$templist = '{style}/list_soft.htm';
$temparticle = '{style}/article_soft.htm';
}
else if ($rs->Fields('ChannelID')->value == 3) {
$channeltype = 2;
$tempindex = '{style}/index_image.htm';
$templist = '{style}/list_image.htm';
$temparticle = '{style}/article_image.htm';
} //分类--图片
//以下是分类所用的默认命名规则
$namerule = '{typedir}/{Y}{M}{D}/{aid}.html';
$namerule2 = '{typedir}/list_{tid}_{page}.html';
$modname = 'default';
$isdefault = '-1';
$sql0 = "select ID from dede_arctype where ID='$id'";
$rs0 = mysql_query($sql0,$conn2);
$row = mysql_fetch_array($rs0);
if(intval($row['ID'])==0){
$sql1 = "insert into dede_arctype (ID,reID,typename,typedir,isdefault,tempindex,templist,temparticle,namerule,namerule2,modname,channeltype) values ('$id','$reid','$typename','$typedir','$isdefault','$tempindex','$templist','$temparticle','$namerule','$namerule2','$modname','$channeltype')";
//$sql1 = "insert into dede_arctype (ID,reID,typename,typedir) values ($id,$reid,$typename,$typedir)";
$rs1 = mysql_query($sql1,$conn2);
if(!$rs1){
echo $sql1;
echo "<br>";
echo mysql_error();
echo "<br>";
//exit;
}
}
$rs->MoveNext();
$i++;
}
$rs->close();
echo "分类完成<br /><hr />";
?>
<?php
echo "开始转换软件....<br />";
$rs->Open("select * from PE_Soft WHERE SoftID>0 ORDER BY SoftID ASC",$conn,1,1);
$i=0;
while(! $rs->eof) {
$id = $rs->Fields('SoftID')->value; //ID
$title = addslashes($rs->Fields('SoftName')->value); //标题
$classid = $rs->Fields('ClassID')->value; //所属的分类ID
$keywordstr = substr($rs->Fields('Keyword')->value,0,59);
$keywordstr = str_replace("|"," ",$keywordstr); //关键字
$keyword = trim($keywordstr);
$datestr = $rs->Fields('UpdateTime')->value; //文章创建时间
$datearr = explode("-",$datestr);
$yy = $datearr[0] ;
$mm = $datearr[1] ;
$dd = rand(1,28);
$time=mktime(0,0,0,$mm,$dd,$yy);
$click = $rs->Fields('Hits')->value; //文章点击数
$memberID = $rs->Fields('Editor')->value; //文章的编辑人员
$litpic = $rs->Fields('SoftPicUrl')->value;
$writer = $rs->Fields('Inputer')->value;
$language = $rs->Fields('SoftLanguage')->value;
$softtype = $rs->Fields('SoftType')->value;
$accredit = $rs->Fields('CopyrightType')->value;
$softsize = $rs->Fields('SoftSize')->value;
$os = $rs->Fields('OperatingSystem')->value;
$introduce = addslashes($rs->Fields('SoftIntro')->value);
$softrank = $rs->Fields('Stars')->value;
$softlinks = "";
$softurl = $rs->Fields('DownloadUrl')->value;
$softurl = split ('下载地址[0-9]+\|',$softurl);
foreach ($softurl as $i => $value) {
$softlinks = $softlinks.'{dede:link text=\'本地下载\'}'.$softurl[$i]."{/dede:link}";
}
$softlinks = str_replace("} {","",$softlinks);
$softlinks = str_replace("{dede:link text='本地下载'}{/dede:link}","",$softlinks);
$softlinks = addslashes($softlinks);
$sql0 = "select ID from dede_archives where ID='$id'";
$rs0 = mysql_query($sql0,$conn2);
$row = mysql_fetch_array($rs0);
if(intval($row['ID'])==0){
$sql1 = "insert into dede_archives (ID,typeid,channel,title,description,sortrank,pubdate,senddate,adminID,keywords,click,litpic,writer,ismake)
values ('$id','$classid',3,'$title','$description','$time','$time','$time',1,'$keyword','$click','$itpic','$writer','-1')";
$rs1 = mysql_query($sql1,$conn2);
if(!$rs1){
echo $sql1;
echo "<br>";
echo mysql_error();
echo "<br>";
//exit;
}
$id2 = mysql_insert_id();
echo $id2;
if($id2>0){
$sql2 = "insert into dede_addonsoft (aid ,typeid, filetype,language,softtype,accredit,os,softrank,officialUrl,officialDemo,softsize,softlinks,introduce )
values('$id','$classid','$filetype','$language','$softtype','$accredit','$os','$softrank','$officialUrl','$officialDemo','$softsize','$softlinks','$introduce');";
$rs2 = mysql_query($sql2,$conn2);
if(!$rs2){
echo $sql2;
echo "<br>";
echo mysql_error();
echo "<br>";
//exit;
}
}
}
$rs->MoveNext();
$i++;
}
$rs->close();
echo "软件转换完成<hr />";
?>
<?php
echo "开始转换文章....<br />";
//$rs = new com("ADODB.RecordSet");
$rs->Open("select * from PE_Article WHERE ArticleID>0 ORDER BY ArticleID ASC",$conn,1,1);
$i=0;
while(! $rs->eof) {
$id = $rs->Fields('ArticleID')->value; //文章ID
$title = addslashes($rs->Fields('Title')->value); //文章标题
$title = str_replace(" "," ",$title);
$classid = $rs->Fields('ClassID')->value; //所属的分类ID
$keywordstr = $rs->Fields('Keyword')->value;
$keywordstr = str_replace("|"," ",$keywordstr); //关键字
$keyword = trim($keywordstr);
$datestr = $rs->Fields('UpdateTime')->value; //文章创建时间
$datearr = explode("-",$datestr);
$yy = $datearr[0] ;
$mm = $datearr[1] ;
$dd = rand(1,28);
$time=mktime(0,0,0,$mm,$dd,$yy);
$content =addslashes($rs->Fields('Content')->value); //文章内容
$content = str_replace('[InstallDir_ChannelDir]{$UploadDir}','/UploadFiles',$content);
$click = $rs->Fields('Hits')->value; //文章点击数
$memberID = $rs->Fields('Editor')->value; //文章的编辑人员
$sql0 = "select ID from dede_archives where ID='$id'";
$rs0 = mysql_query($sql0,$conn2);
$row = mysql_fetch_array($rs0);
//写入到DEDE数据库中
if(intval($row['ID'])==0){
$sql1 = "insert into dede_archives (ID,typeid,channel,title,sortrank,pubdate,senddate,adminID,keywords,click)
values ('$id','$classid',1,'$title','$time','$time','$time',1,'$keyword','$click')";
$rs1 = mysql_query($sql1,$conn2);
if(!$rs1){
echo $sql1;
echo "<br>";
echo mysql_error();
echo "<br>";
//exit;
}
$id2 = mysql_insert_id();
if($id2>0){
$sql2 = "insert into dede_addonarticle (aid ,typeid, body ) values('$id','$classid','$content');";
$rs2 = mysql_query($sql2,$conn2);
if(!$rs2){
echo $sql2;
echo "<br>";
echo mysql_error();
echo "<br>";
//exit;
}
}
}
$rs->MoveN
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
动易数据转DedeCms2007_petodede_CMS程序开发模板(使用说明+源代码+html).zip (1个子文件)
[CMS程序]动易数据转DedeCms2007_petodede
pe转dede 程序
index.php 12KB
共 1 条
- 1
资源评论
CrMylive.
- 粉丝: 1w+
- 资源: 4万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于javaweb的网上拍卖系统,采用Spring + SpringMvc+Mysql + Hibernate+ JSP技术
- polygon-mumbai
- Chrome代理 switchyOmega
- GVC-全球价值链参与地位指数,基于ICIO表,(Wang等 2017a)计算方法
- 易语言ADS指纹浏览器管理工具
- 易语言奇易模块5.3.6
- cad定制家具平面图工具-(FG)门板覆盖柜体
- asp.net 原生js代码及HTML实现多文件分片上传功能(自定义上传文件大小、文件上传类型)
- whl@pip install pyaudio ERROR: Failed building wheel for pyaudio
- Constantsfd密钥和权限集合.kt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功