动易CMS数据转成dedecms的php程序
来源:易贤网 阅读:1412 次 日期:2016-07-07 10:20:51
温馨提示:易贤网小编为您整理了“动易CMS数据转成dedecms的php程序”,方便广大网友查阅!

PS:这个可以举一反三,如新云或NB等asp文章系统都可转为dedecms或其它php的cms

CODE:

代码如下:

<?php

//读取mdb数据库例程

set_time_limit(0);

$conn = new com("ADODB.Connection");

$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("E:\web2\qq.mdb");

$conn->Open($connstr);

$rs = new com("ADODB.RecordSet");

$rs->Open("select * from PE_Article Where ArticleID>0 orDER BY ArticleID ASC",$conn,1,1);

$conn2 = mysql_connect("localhost","root","");

mysql_select_db("dede",$conn2);

mysql_query("SET NAMES GBK",$conn2);

$i=0;

while(! $rs->eof) {

$id = $rs->Fields('ArticleID')->value;

$title = addslashes($rs->Fields('Title')->value);

$classid = $rs->Fields('ClassID')->value;

$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);

//$uploadfile = $rs->Fields('UploadFiles')->value;

$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,sortrank,pubdate,senddate,adminID,keywords) values ('$id','$classid',1,'$title','$time','$time','$time',1,'$keyword')";

$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->MoveNext();

$i ;

if($iP==0)sleep(5);

}

echo "完成";

?>

更多信息请查看CMS教程
易贤网手机网站地址:动易CMS数据转成dedecms的php程序
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 云南省教育厅备案号:云教ICP备0901021 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标