Home > Article > Backend Development > PHP imports locomotive collected db3 data into dedecms complete code_PHP tutorial
php tutorial imports locomotive collection db3 data into dedecms complete code
$path ="d:pdoSpiderResult.db3";
$conn = new PDO("sqlite:$path");
$ array=array('','','');
if( $conn )
{
//echo ('connection pdo success');
}
else
{
echo ('cnnection pdo fail ,please 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 photo album';//title
//file title
$softcontent = str_replace(' Image/','http://g.111cn.cn/javascript tutorial/Image/',mb_convert_encoding($row
[4],'gbk','auto')); target=_blank>'.$softtitle .'
//file size of size
$softsize = 'Unknown';
// file downurl
$softurl = str_replace('.zip','', $row['address']);
$filetype='.rar';
$softpath='http://g.111cn.cn/javascript/'.$softurl.$filetype;
$view ='
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);
// Random Clicks 1000, 10000 btween
$archives = "Insert into d_archives
$archives.=" values
mysql_query($archives) or die('archives '.$ archives.'|'.mysql_error()); //$archives.
$arctiny = "Insert into d_arctiny(id,typeid,typeid2,arcrank,channel,senddate,sortrank,mid) values
mysql_query( $arctiny) or die( 'arctiny'.$arctiny.mysql_error( ));//$arctiny.
}
echo 'There are many in total',$count,"no place";