火车采集器软件交流官方论坛

 找回密码
 加入会员
搜索
火车采集器V9版免费下载火车浏览器 - 可视采集,万能群发,全自动脚本工具
查看: 6735|回复: 5

分享火车头8.X 2.X mysql语法导入ECMS帝国7.0完美无错版

[复制链接]
发表于 2014-10-2 23:24:19 | 显示全部楼层 |阅读模式
  1. INSERT INTO phome_ecms_stock(classid,title,newstime,Brand,subtitle,goods,moq,spq,Description,stock,leadtime,RMB,qq,com,username,userid,havehtml,newspath,stb) VALUES('[标签:分类ID]','[标签:标题]','[系统时间戳]','[标签:品牌]','[标签:标题]','[标签:类型]','0','0','[标签:描述]','[标签:stock]','1-2周','[标签:Price]','257386','[标签:公司]','admin','1','1','20141002','1')

  2. INSERT INTO phome_ecms_stock_data_2(id,classid,keyid,dokey,newstempid,closepi,haveaddfen,infotags) VALUES ('[文章编号:phome_ecms_stock]','[标签:分类ID]','','0','0','0','0','0')

  3. INSERT INTO phome_ecms_stock_index(id,classid,checked,newstime,truetime,lastdotime,havehtml) VALUES('[文章编号:phome_ecms_stock]','[标签:分类ID]','1','[系统时间戳]','[系统时间戳]','[系统时间戳]','1')

  4. update  phome_ecms_stock set `filename`=`id` where id=[文章编号:phome_ecms_stock]

  5. update `phome_ecms_stock` set titleurl=CONCAT('/stock/','[系统时间戳],'/','[文章编号:phome_ecms_stock]','.html')
复制代码
每个人的需求不一样,字段也不一样,请根据自己的需求更改。

以上是5句MYSQL,每段一个回车,顺应火车头的mysql语法要求。
以及不要在msyq命令后面增加结束符号【;】注意分号哦,分号是命令结束符号。
分享也当做是自己后期的备忘录吧。
 楼主| 发表于 2014-10-2 23:26:47 | 显示全部楼层
以下为帝国ECMS结合火车头的文件,类似于自定义API工具吧,相关信息需要自己去修改。
  1. <?php
  2. /**
  3. 1、本接口基本上全部是数据库操作,因此所采集的数据一定要对应数据库字段,否则内容就不是自己想要的了。
  4. 2、本接口只适合帝国CMS7.0系统,如果您用的是7.0以下系统请自行修改文件。
  5. 3、此接口经过差不多1个月的测试,没有问题。可以正常的更新和添加文章,因此如果您觉得不好用可以找其他接口。
  6. 4、由于根据自己的需要做的接口,因此如果你想自己用可能得自己修改了,这个接口只是做一个参考,如果你懂一点点代码改起来应该不难。

  7. **/
  8. header('conten-type:text/html;charset=gb2312');
  9. $password='stock';                        // 验证密码所用, 发表地址后缀: /e/admin/stock.php?pw=stock
  10. if($password!=$_GET['pw']) exit('验证密码错误');   //安全检测,密码不符则退出
  11. define('InEmpireCMS',TRUE);
  12. include("e/config/config.php");
  13. define('DB_HOST',$ecms_config['db']['dbserver']);        //数据库登录地址
  14. define('DB_PASSWORD',$ecms_config['db']['dbpassword']);//数据库密码
  15. define('DB_USER',$ecms_config['db']['dbusername']);//数据库用户名
  16. define('DB_NAME',$ecms_config['db']['dbname']);////数据库名
  17. $db = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) ;
  18. mysql_select_db(DB_NAME,$db) ;
  19. mysql_query("set names gb2312");
  20. mysql_query("SET character_set_results=gb2312");
  21. /////////////////////////////////////////////初始化配置
  22. $times = time();
  23. $times2 = time(); //对应自动发布时间
  24. $id =  $_POST['stock_id'];//ID必须有
  25. /////////////////////////////////////////////主表phome_ecms_stock
  26. $stock = ''; //这个为分类,你采集的文章肯定有分类,每个分类对应一个栏目
  27. $title = $_POST['title'] ;
  28. $subtitle = $_POST['subtitle'] ;
  29. $stock_id = $_POST['stock_id'] ; //ID必须有
  30. $titlepic = $_POST['titlepic'] ;
  31. $smalltext = $_POST['smalltext'] ;
  32. $newstime =  $times ; //
  33. $diggtop = $_POST['diggtop'] ; //顶
  34. $diggdown = $_POST['diggdown'] ; //踩,如果自己没有加这个字段可以自己加也可放着
  35. $infopfen = $_POST['infopfen'] ; //评分数
  36. $infopfennum = $_POST['infopfennum'] ; //评分人数
  37. $onclick = $_POST['onclick'] ; //浏览人数
  38. $filename= $id ;
  39. $ttid='0';
  40. $plnum=0;
  41. $totaldown=0;
  42. $newspath='';
  43. $userid=1; //管理员ID
  44. $username='admin';   //发布账号
  45. $firsttitle=0;
  46. $isgood=0;
  47. $ispic=0;
  48. $istop=0;
  49. $isqf='0';
  50. $ismember=0;
  51. $isurl=0;
  52. $truetime=$times;
  53. $lastdotime=$times;
  54. $havehtml=1;
  55. $groupid=0;
  56. $userfen=0;
  57. $titlefont='';
  58. $stb=0;
  59. $fstb=1;
  60. $restb=1;
  61. $keyboard='';
  62. $goods=$_POST['goods'];
  63. $moq=$_POST['moq'];
  64. $spq=$_POST['spq'];
  65. $box=$_POST['box'];
  66. $Description=$_POST['Description'];
  67. $stock=$_POST['stock'];
  68. $leadtime=$_POST['leadtime'];
  69. $RMB=$_POST['RMB'];
  70. $qq=$_POST['qq'];
  71. $com=$_POST['com'];
  72. $Brand=$_POST['Brand'];


  73. /////////////////////////////////////////////副表phome_ecms_stock_data_1
  74. $writer = $_POST['writer'] ;
  75. $befrom = $_POST['befrom'] ;
  76. $newstext = $_POST['newstext'] ;
  77. $stock_pf = $_POST['stock_pf'] ;
  78. $keyid='';
  79. $dokey=0;
  80. $newstempid=0;
  81. $closepl=0;
  82. $haveaddfen=0;
  83. $infotags='';
  84. /////////////////////////////////////////////索引表phome_ecms_stock_index
  85. $checked=0; //信息属性:审核   1 为审核  0为非审核,只有为0的时候才能延迟发布文章
  86. /////////////////////////////////////////////phome_enewsinfovote
  87. $id3 = 1000010000000000 + $id ;
  88. $pubid = number_format($id3,'','','') ;
  89. $votenum = 0 ;
  90. $voteip = '';
  91. $votetext ='';
  92. $voteclass = 0;
  93. $doip = 0;
  94. $dotime ='0000-00-00';
  95. $tempid =1 ;
  96. $width = 500 ;
  97. $height = 300 ;
  98. $diyotherlink = '';
  99. $infouptime = $times2 ;
  100. $infodowntime = 0;
  101. $copyids = '';





  102. ?>
  103. <?php
  104. $enews=$_POST['enews'];
  105. if(empty($enews))
  106. {
  107.         $enews=$_GET['enews'];
  108. }
  109. if(!$_POST){
  110. // 列出终极栏目
  111. $qbrand = mysql_query("SELECT classid,classname,bclassid FROM `".$dbtbpre."enewsclass` where islast=1  order by myorder,classid desc ");
  112.     echo '<select name="classid">';
  113.     while($row = mysql_fetch_array($qbrand)){
  114.         $qbrand2 = mysql_query("SELECT classid,classname,bclassid FROM `".$dbtbpre."enewsclass` where classid='".$row['bclassid']."'");
  115.          while($row2 = mysql_fetch_array($qbrand2)){
  116.           echo '<option value="'.$row['classid'].'">'.$row2['classname'].$row['classname'].'</option>';
  117.                 }
  118.                 }
  119.         echo '</select><br />';               
  120. }else{
  121.    if ( get_magic_quotes_gpc ()) {
  122.       stripslashes ( $_POST );
  123.     }
  124. @extract($_POST);
  125. ?>

  126. <?php
  127. $qbrand3 = mysql_query("SELECT classid , classpath  FROM `".$dbtbpre."enewsclass` where classname='".$stock."' and bclassid='".$bclassid."' ");
  128. while($row3 = mysql_fetch_array($qbrand3)){
  129. $classid = $row3['classid'] ;  //该栏目的ID
  130. $classpath = $row3['classpath'] ;
  131.                 }       
  132. if(!$classpath){
  133. $classid = 709;
  134. $classpath = 'lingshi';
  135. }
  136. $titleurl = '/' . $classpath . '/' . $id . '.html'; //外部链接       
  137.        
  138. $qbrand4 = mysql_query("SELECT stock_id  FROM `".$dbtbpre."ecms_stock` where id='".$id."' ");
  139. while($row4 = mysql_fetch_array($qbrand4)){
  140. $id_4 = $row4['stock_id'] ;  //
  141.                 }
  142. $qbrand5 = mysql_query("SELECT stock_id  FROM `".$dbtbpre."ecms_stock_check` where id='".$id."' ");
  143. while($row5 = mysql_fetch_array($qbrand5)){
  144. $id_5 = $row5['stock_id'] ;  //
  145.                 }
  146. ?>       
  147. <?php
  148. mysql_query("BEGIN");
  149. if($enews=="AddNews"){
  150. if($id_4)
  151. {
  152. $checked=1;
  153. $phome_ecms_stock = mysql_query(" UPDATE ".$dbtbpre."ecms_stock  SET  classid='$classid' , ttid='$ttid' , onclick='$onclick' , plnum='$plnum' , totaldown='$totaldown' , newspath='$newspath' , filename='$filename' , userid='$userid' , username='$username' , firsttitle='$firsttitle' , isgood='$isgood' , ispic='$ispic' , istop='$istop' , isqf='$isqf' , ismember='$ismember' , isurl='$isurl' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' , groupid='$groupid' , userfen='$userfen' , titlefont='$titlefont' , titleurl='$titleurl' , stb='$stb' , fstb='$fstb' , restb='$restb' , keyboard='$keyboard' , title='$title' , newstime='$newstime' , titlepic='$titlepic' , subtitle='$subtitle' , smalltext='$smalltext' , diggtop='$diggtop' , infopfen='$infopfen' , infopfennum='$infopfennum' , diggdown='$diggdown' , stock='$stock'  , stock_tel='$stock_tel' , stock_xy='$stock_xy' , stock_xyurl='$stock_xyurl' , stock_rz='$stock_rz' , stock_tg='$stock_tg' , stock_jt='$stock_jt' , stock_rel='$stock_rel' , stock_30yj='$stock_30yj' , stock_dq='$stock_dq' WHERE id = '$id_4'goods=goods',moq=moq',spq=spq',box=box',Description=Description',stock=stock',leadtime=leadtime',RMB=RMB',qq=qq',com=com',Brand=Brand'");
  154. echo '$phome_ecms_stock ' . mysql_errno() . ": " . mysql_error()  ;

  155. $phome_ecms_stock_data_1 = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_data_1 SET classid='$classid' , keyid='$keyid' , dokey='$dokey' , newstempid='$newstempid' , closepl='$closepl' , haveaddfen='$haveaddfen' , infotags='$infotags' , writer='$writer' , befrom='$befrom' , newstext='$newstext' , stock_pf='$stock_pf' WHERE id = '$id_4'  ");

  156. echo '$phome_ecms_stock_data_1 ' .  mysql_errno() . ": " . mysql_error()  ;

  157. $phome_ecms_stock_index = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_index SET classid='$classid' , checked='$checked' , newstime='$newstime' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' WHERE id = '$id_4'  ");

  158. echo '$phome_ecms_stock_index ' .  mysql_errno() . ": " . mysql_error()  ;

  159. $phome_enewsinfovote = mysql_query(" UPDATE ".$dbtbpre."enewsinfovote SET pubid='$pubid' , classid='$classid' , title='$title' , votenum='$votenum' , voteip='$voteip' , votetext='$votetext' , voteclass='$voteclass' , doip='$doip' , dotime='$dotime' , tempid='$tempid' , width='$width' , height='$height' , diyotherlink='$diyotherlink' , infouptime='$infouptime' , infodowntime='$infodowntime' , copyids='$copyids'  WHERE id = '$id_4' ");
  160. echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error()  ;

  161. echo "id_4已审核产品发布成功!" ;

  162. mysql_query("END");

  163. mysql_close($db);       
  164. }
  165. elseif($id_5)
  166. {
  167. $phome_ecms_stock_check = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_check  SET  classid='$classid' , ttid='$ttid' , onclick='$onclick' , plnum='$plnum' , totaldown='$totaldown' , newspath='$newspath' , filename='$filename' , userid='$userid' , username='$username' , firsttitle='$firsttitle' , isgood='$isgood' , ispic='$ispic' , istop='$istop' , isqf='$isqf' , ismember='$ismember' , isurl='$isurl' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' , groupid='$groupid' , userfen='$userfen' , titlefont='$titlefont' , titleurl='$titleurl' , stb='$stb' , fstb='$fstb' , restb='$restb' , keyboard='$keyboard' , title='$title' , newstime='$newstime' , titlepic='$titlepic' , subtitle='$subtitle' , smalltext='$smalltext' , diggtop='$diggtop' , infopfen='$infopfen' , infopfennum='$infopfennum' , diggdown='$diggdown' , stock='$stock' , stock_id='$stock_id' , stock_tel='$stock_tel' , stock_xy='$stock_xy' , stock_xyurl='$stock_xyurl' , stock_rz='$stock_rz' , stock_tg='$stock_tg' , stock_jt='$stock_jt' , stock_rel='$stock_rel', stock_30yj='$stock_30yj', stock_dq='$stock_dq' WHERE id = '$id_5'goods=goods',moq=moq',spq=spq',box=box',Description=Description',stock=stock',leadtime=leadtime',RMB=RMB',qq=qq',com=com',Brand=Brand' ");
  168. echo '$phome_ecms_stock_check ' . mysql_errno() . ": " . mysql_error()  ;

  169. $phome_ecms_stock_check_data = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_check_data SET classid='$classid' , keyid='$keyid' , dokey='$dokey' , newstempid='$newstempid' , closepl='$closepl' , haveaddfen='$haveaddfen' , infotags='$infotags' , writer='$writer' , befrom='$befrom' , newstext='$newstext' , stock_pf='$stock_pf' WHERE id = '$id_5'  ");

  170. echo '$phome_ecms_stock_check_data ' . mysql_errno() . ": " . mysql_error()  ;

  171. $phome_ecms_stock_index = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_index SET classid='$classid' , checked='$checked' , newstime='$newstime' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' WHERE id = '$id_5'  ");

  172. echo '$phome_ecms_stock_index ' . mysql_errno() . ": " . mysql_error()  ;

  173. $phome_enewsinfovote = mysql_query(" UPDATE ".$dbtbpre."enewsinfovote SET pubid='$pubid' , classid='$classid' , title='$title' , votenum='$votenum' , voteip='$voteip' , votetext='$votetext' , voteclass='$voteclass' , doip='$doip' , dotime='$dotime' , tempid='$tempid' , width='$width' , height='$height' , diyotherlink='$diyotherlink' , infouptime='$infouptime' , infodowntime='$infodowntime' , copyids='$copyids'  WHERE id = '$id_5' ");

  174. echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error()  ;

  175. echo $id_5 . "id_5未审核产品发布成功!";

  176. mysql_query("END");

  177. mysql_close($db);       

  178. }
  179. else{
  180. ?>

  181. <?php
  182. if($checked==0){
  183. $phome_ecms_stock_check = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_check (id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,title,newstime,titlepic,subtitle,smalltext,diggtop,infopfen,infopfennum,diggdown,stock,stock_id,stock_tel,stock_xy,stock_xyurl,stock_rz,stock_tg,stock_jt,stock_rel,stock_30yj,stock_dq) VALUES ('$id','$classid','$ttid','$onclick','$plnum','$totaldown','$newspath','$filename','$userid','$username','$firsttitle','$isgood','$ispic','$istop','$isqf','$ismember','$isurl','$truetime','$lastdotime','$havehtml','$groupid','$userfen','$titlefont','$titleurl','$stb','$fstb','$restb','$keyboard','$title','$newstime','$titlepic','$subtitle','$smalltext','$diggtop','$infopfen','$infopfennum','$diggdown','$stock','$stock_id','$stock_tel','$stock_xy','$stock_xyurl','$stock_rz','$stock_tg','$stock_jt','$stock_rel','$stock_30yj','$stock_dq')");
  184. echo '$phome_ecms_stock_check ' . mysql_errno() . ": " . mysql_error()  ;

  185. $phome_ecms_stock_check_data = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_check_data (id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags,writer,befrom,newstext,stock_pf) VALUES ('$id','$classid','$keyid','$dokey','$newstempid','$closepl','$haveaddfen','$infotags','$writer','$befrom','$newstext','$stock_pf')");       

  186. echo '$phome_ecms_stock_check_data ' . mysql_errno() . ": " . mysql_error()  ;
  187. }
  188. else{
  189. $phome_ecms_stock = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock (id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,title,newstime,titlepic,subtitle,smalltext,diggtop,infopfen,infopfennum,diggdown,stock,stock_id,stock_tel,stock_xy,stock_xyurl,stock_rz,stock_tg,stock_jt,stock_rel,stock_30yj,stock_dq,'goods','moq','spq','box','Description','stock','leadtime','RMB','qq','com','Brand') VALUES ('$id','$classid','$ttid','$onclick','$plnum','$totaldown','$newspath','$filename','$userid','$username','$firsttitle','$isgood','$ispic','$istop','$isqf','$ismember','$isurl','$truetime','$lastdotime','$havehtml','$groupid','$userfen','$titlefont','$titleurl','$stb','$fstb','$restb','$keyboard','$title','$newstime','$titlepic','$subtitle','$smalltext','$diggtop','$infopfen','$infopfennum','$diggdown','$stock','$stock_id','$stock_tel','$stock_xy','$stock_xyurl','$stock_rz','$stock_tg','$stock_jt','$stock_rel','$stock_30yj','$stock_dq','$goods','$moq','$spq','$box','$Description','$stock','$leadtime','$RMB','$qq','$com','$Brand')");

  190. echo '$phome_ecms_stock ' . mysql_errno() . ": " . mysql_error()  ;

  191. $phome_ecms_stock_data_1 = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_data_1 (id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags,writer,befrom,newstext,stock_pf) VALUES ('$id','$classid','$keyid','$dokey','$newstempid','$closepl','$haveaddfen','$infotags','$writer','$befrom','$newstext','$stock_pf')");       

  192. echo '$phome_ecms_stock_data_1 ' . mysql_errno() . ": " . mysql_error()  ;

  193. }
  194. $phome_ecms_stock_index = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_index (id,classid,checked,newstime,truetime,lastdotime,havehtml) VALUES ('$id','$classid','$checked','$newstime','$truetime','$lastdotime','$havehtml')");

  195. echo '$phome_ecms_stock_index ' . mysql_errno() . ": " . mysql_error()  ;       

  196. $phome_enewsinfovote = mysql_query("INSERT INTO ".$dbtbpre."enewsinfovote (pubid,id,classid,title,votenum,voteip,votetext,voteclass,doip,dotime,tempid,width,height,diyotherlink,infouptime,infodowntime,copyids) VALUES ('$pubid','$id','$classid','$title','$votenum','$voteip','$votetext','$voteclass','$doip','$dotime','$tempid','$width','$height','$diyotherlink','$infouptime','$infodowntime','$copyids')");

  197. echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error()  ;       

  198. echo "产品发布成功!";

  199. mysql_query("END");

  200. mysql_close($db);                       

  201. }
  202. }
  203. ?>

  204. <?php
  205. }
  206. ?>
复制代码
发表于 2014-10-12 12:46:58 | 显示全部楼层
请问这个是做什么用的?谢谢。。
发表于 2014-10-14 00:17:50 | 显示全部楼层
貌似不能用吧。一楼提到的那几个表。7.0的帝国。都没有这些表了。


发表于 2015-1-10 21:54:16 | 显示全部楼层
是呀!
有好几个表没有
怎么弄!
发表于 2015-4-11 18:11:43 | 显示全部楼层
01.<?php

02./**

03.1、本接口基本上全部是数据库操作,因此所采集的数据一定要对应数据库字段,否则内容就不是自己想要的了。

04.2、本接口只适合帝国CMS7.0系统,如果您用的是7.0以下系统请自行修改文件。

05.3、此接口经过差不多1个月的测试,没有问题。可以正常的更新和添加文章,因此如果您觉得不好用可以找其他接口。

06.4、由于根据自己的需要做的接口,因此如果你想自己用可能得自己修改了,这个接口只是做一个参考,如果你懂一点点代码改起来应该不难。

07.

08.**/

09.header('conten-type:text/html;charset=gb2312');

10.$password='stock';                        // 验证密码所用, 发表地址后缀:http://www.jixiejianshe.com/

11.if($password!=$_GET['pw']) exit('验证密码错误');   //安全检测,密码不符则退出

12.define('InEmpireCMS',TRUE);

13.include("e/config/config.php");

14.define('DB_HOST',$ecms_config['db']['dbserver']);        //数据库登录地址

15.define('DB_PASSWORD',$ecms_config['db']['dbpassword']);//数据库密码

16.define('DB_USER',$ecms_config['db']['dbusername']);//数据库用户名

17.define('DB_NAME',$ecms_config['db']['dbname']);////数据库名

18.$db = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) ;

19.mysql_select_db(DB_NAME,$db) ;

20.mysql_query("set names gb2312");

21.mysql_query("SET character_set_results=gb2312");
您需要登录后才可以回帖 登录 | 加入会员

本版积分规则

QQ|手机版|Archiver|火车采集器官方站 ( 皖ICP备06000549 )

GMT+8, 2024-9-21 09:31

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表