Php imports db3 data collected by the locomotive to dedecms

Source: Internet
Author: User
Tags mysql tutorial

$ Path = "d: pdoSpiderResult. db3 ";
$ Conn = new PDO ("sqlite: $ path ");
$ Array = array ('','','');

If ($ conn)
 {
// Echo ('connection pdo success ');
 }
Else
 {
Echo ('cnnection pdo fail, plase check database server! ');
 }
$ Count = 0;
$ Sp = new SplitWord ();
Foreach ($ conn-> query ('select * FROM content limit 160,80 ') as $ row)
 {
  
// Baise info
  
$ Softtitle = mysql tutorial _ escape_string (mb_convert_encoding ($ row [3], 'gbk', 'auto'). '-js album'; // title
  
// File title
  
$ Softcontent = str_replace ('image/', 'http: // g.111cn.net/javascripttutorial /image/',mb_convert_encoding ($ row

[4], 'gbk', 'auto '));
  
// File size of size
  
$ Softsize = 'unknown ';
  
// File downurl
  
$ Softurl = str_replace('.zip ', '', $ row ['address']);
Using filetype='.rar ';
$ Softpath = 'http: // g.111cn.net/javascript/'.w.literalurl.w.filetype;
$ View = '<br/> effect preview address <a href = http://g.111cn.net/javascript/'.w.literalurl .'

Target = _ blank> '. $ softtitle.' </a> '; // effect preview address

Preg_match_all ("/(src | SRC) = [" | '|] {0 ,}((. *). (gif | jpg | jpeg | png | bmp)/isU ", $ softcontent, $ img_array );
$ Thum = str_replace ("'", '', str_replace ('" ', '', $ img_array [2] [0]);
$ Softlinks = mysql_escape_string ("{dede: link islocal = '1' text = '$ localhost'}". $ softpath. "{/dede: link }");
$ A = strip_tags ($ softcontent );
$ B = $ sp-> SplitRMM ($ softtitle );
$ Keywords = str_replace ('', ',', $ B );
  
$ Desciption = ''; // desc + split word
$ Introduce = $ softcontent. $ desciption. $ view;
$ OS = 'win2003, WinXP, Win2000, win9x ';
// Call out link descript
   
$ Addsoft = "Insert into d_addonsoft (typeid, filetype, language, softtype, accredit,

OS, softrank, officialUrl, officialDemo, softsize, softlinks, introduce, templet, userip, redirecturl )";
$ Addsoft. = "values

('$ Typeid',' $ filetype', '$ language', '','', '$ OS', '3 ','','', '$ softsize ','". $ softlinks. "',' $ introduce ',', '222. 103.69.94 ','')";

Mysql_query ($ addsoft) or die ('addsoft '. $ addsoft. mysql_error (); //. $ addsoft
$ Newid = mysql_insert_id ();
  
// Read insert new id
          
$ Sortrank = time ();
  
// Read the minutes and seconds when the system is currently
  
$ Click = mt_rand (1000,10000 );
  
// Randclicks 1000,100 00 btween
  
  
$ Archives = "Insert into d_archives

(Id, typeid, typeid2, sortrank, flag, ismake, channel, arcrank, click, money, title, litpic, writer, source, pubdate, senddate, mid, descripti

On, keywords )";
$ Archives. = "values

('$ Newid',' $ typeid', '0', '$ sortrank', 'P', '1', '3', '0 ', '$ Click', '0',' $ softtitle', '$ thum', '$ write', 'unkown', '$ sortrank', '$ sortran

K', 1, '$ desciption', '$ keyword ')";
  
Mysql_query ($ archives) or die ('archivees'. $ archives. '|'. mysql_error (); // $ archives.
$ Arctiny = "Insert into d_arctiny (id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid) values

($ Newid, $ typeid, 0, 0, 3, '$ sortrank', '$ sortrank', 1 )";
  
Mysql_query ($ arctiny) or die ('arctiny'. $ arctiny. mysql_error (); // $ arctiny.
 
 }
Echo 'There are multiple records in total ', $ count, "non-stored ";

SOURCE. net Tutorial "> www.111cn.net

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.