Dedecms picture template Moving easy data into dedecms PHP program

Source: Internet
Author: User
PS: This can be extrapolate, such as new cloud or NB and other ASP article system can be converted to dedecms or other PHP cms

Copy the Code code as follows:


Read MDB database routines
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);
$conn 2 = mysql_connect ("localhost", "root", "");
mysql_select_db ("Dede", $conn 2);
mysql_query ("SET NAMES GBK", $conn 2);
$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;
$sql 0 = "Select ID from dede_archives where id= ' $id '";
$rs 0 = mysql_query ($sql 0, $conn 2);
$row = Mysql_fetch_array ($rs 0);
if (Intval ($row [' ID ']) ==0) {
$sql 1 = "INSERT into dede_archives (id,typeid,channel,title,sortrank,pubdate,senddate,adminid,keywords) VALUES (' $id ' , ' $classid ', 1, ' $title ', ' $time ', ' $time ', ' $time ', 1, ' $keyword ');
$rs 1 = mysql_query ($sql 1, $conn 2);
if (! $rs 1) {
echo $sql 1;
echo "
";
Echo Mysql_error ();
echo "
";
Exit
}
$id 2 = mysql_insert_id ();
if ($id 2>0) {
$sql 2 = "INSERT into dede_addonarticle (aid, typeid, body) VALUES (' $id ', ' $classid ', ' $content ');";
$rs 2 = mysql_query ($sql 2, $conn 2);
if (! $rs 2) {
echo $sql 2;
echo "
";
Echo Mysql_error ();
echo "
";
Exit
}
}
}
$rs->movenext ();
$i + +;
if ($i%50==0) sleep (5);
}
echo "Done";
?>

The above describes the Dedecms picture template moving easy data into the dedecms PHP program, including the Dedecms picture template aspects, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.