Php imports db3 data collected by the locomotive engine to dedecms complete code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags mysql tutorial
Php imports the db3 data collected by the locomotive to dedecms. The php Tutorial imports the db3 data collected by the locomotive to dedecms with the complete code $ pathd: pdoSpiderResult. db3; $ connnewPDO (sqlite: $ path); $ arrayarray (,); if ($ conn) {echo (connec php Tutorial: import the db3 data collected by the locomotive to dedecms
$ 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.cn/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.cn/javascript/'.w.literalurl.w.filetype;
$ View ='
Effect preview address: http://g.111cn.cn/javascript/'.w.literalurl .'

Target = _ blank> '. $ softtitle. ''; // 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 ";

Original site reprinted with the source. net Tutorial "> www.bkjia.com


Butler imports the db3 data collected by the locomotive to dedecms. complete code $ path = d: pdoSpiderResult. db3; $ conn = new PDO (sqlite: $ path); $ array = array ('','', ''); if ($ conn) {// echo ('C c...

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.