<?php 	require_once('_approot.php');	?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	//装入测试数据 -tt-

	$opertb=new mytb();
	//$cleartable="ls_products,ls_news,ls_message,ls_article,ls_singlepages,ls_download,ls_video";
	$gentable="workshop,certificate,quality,packing,revolvingpics,rd,brand,management,history";
	$cleartable="ls_products,ls_news,ls_message,ls_article,ls_singlepages,ls_download,ls_video";  // 装入的

	$Actionarr=explode(",",$cleartable);
	
	$conn_bak=@mysqli_connect("localhost","root","ls8723") or die ("can't connect DBS "."flllbak");
				mysqli_select_db($conn_bak,"flllbak");
				mysqli_set_charset($conn_bak,"utf8");
	
	for($j=0;$j<count($Actionarr); $j++)
	{
	
		$Action=trim($Actionarr[$j]);
		//var_dump($Actionarr,$Action);
		//if(strpos($gentable ,$Action)!==false)$_GET['gen']=$Action; else $_GET['gen']="";
	
	switch ($Action){
		
		
		case "ls_products":	//装入产品
								
				$clear_sql="insert into ls_products select * from flllbak.ls_products where productName like '%-tt-%' or cateName   like '%-tt-%'  or midcateName   like '%-tt-%' or subcateName   like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				
				 
			  echo "products ".getnum($clear_sql)." 已装入 <br/>";

		  break;	
		  
		 case "ls_functioncates"://装入新闻、博客、常见问题分类
				$clear_sql="insert into ls_functioncates select * from flllbak.ls_functioncates where cateName like '%-tt-%' or  functionName like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				
				 echo "ls_functioncates 新闻、博客、常见问题分类 ".getnum($clear_sql)." 已装入 <br/>";
		   break;	
		  
/*		 case "ls_faqs"://装入新闻、博客、常见问题分类
				$clear_sql="insert into faqs select * from flllbak.faqs where newsTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				
				 
 
				  echo " news 已装入 ".getnum($clear_sql)." 条  <br/>";		 
				  break;*/

		 
		 case "ls_news": //装入新闻
				$clear_sql="insert into ls_news select * from flllbak.ls_news where newsTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
 
				  echo " news 已装入 ".getnum($clear_sql)." 条  <br/>";
				
				break;	
				
 			 case "ls_article": //装入文章
				$clear_sql="insert into ls_article select * from flllbak.ls_article where articleTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
				  echo " ls_article 已装入 ".getnum($clear_sql)." 条  <br/>";
		   			
				 	break;	
			 	
			 case "ls_singlepages": //装入文章
			 
				$clear_sql="insert into ls_singlepages select * from flllbak.ls_singlepages where pageTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
					  echo " singlepages 已装入 ".getnum($clear_sql)." 条  <br/>";
	   			
				 	break;	
			
			
		 case "ls_download"://装入下载
		 	  
				$clear_sql="insert into ls_download select * from flllbak.ls_download where downloadTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
				 echo " download 已装入 ".getnum($clear_sql)." 条, 上传文件已装入  <br/>";
				
				break;	
				
		 
				
		case "ls_video"://装入视频 videoName
		
		 	 
				$clear_sql="insert into ls_video select * from flllbak.ls_video where videoName like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
				 echo " video 已装入 ".getnum($clear_sql)." 条, 上传视频已装入  <br/>";
				
				break;	
				

			
		case "ls_pro_feedback"://装入反馈 requirement
				$clear_sql="insert into ls_pro_feedback select * from flllbak.ls_pro_feedback where requirement like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				 
			  echo " feedback 已装入 ".getnum($clear_sql)." 条  <br/>";
	   			
			break;	
			
			
			 

		case "ls_problem"://装入老的常见问题
				$clear_sql="insert into ls_problem select * from flllbak.ls_problem where problemTitle like '%-tt-%' ";
				$clear_query=$opendb->query($clear_sql);
				echo "faq  ".getnum($clear_sql)." 已装入 <br/>";
		 	break;
			
			
	 
			
		case "ls_motif"://装入车间图片
				
				$clear_sql="insert into ls_motif select * from flllbak.ls_motif  where motifText like '%-tt-%'  ";
				$clear_query=$opendb->query($clear_sql);
				echo "ls_motif 已装入 ".getnum($clear_sql)." 条 <br/>";
				break;

		}

	} // end for
	
	
	$Actionarr=explode(",",$gentable);

	
	for($j=0;$j<count($Actionarr); $j++)
	{
	
		$Action=trim($Actionarr[$j]);
		$_GET['gen']=$Action;
		require('generalpicrequire.php');  //通用图片文件开关语句
		echo $generalTable."- table";
		if(mysqli_num_rows($opendb->query("SHOW TABLES LIKE '".$generalTable."' "))==1)  // 表是否存在
		{
				$opertb->table=$generalTable;
				$clear_sql="insert into `".$generalTable."` select * from flllbak.".$generalTable."  where $generalpicsTitle like '%-tt-%'  ";
				$clear_query=$opendb->query($clear_sql);
			 
				echo $Action." 已装入 ".getnum($clear_sql)." 条 <br/>";
		}
			
	}
	echo " <br/> <br/>";
	xCopy("../../flllbak",  "../../". midfolder($_SERVER['PHP_SELF'])); //复制图片
	
//获取 记录数量	
function getnum($clear_sql){
	$opendb=new mydb();
	$clear_sql=substr($clear_sql,strpos($clear_sql,"select")); // 获得 select 字句
				$clear_query=$opendb->query($clear_sql);
				$nums=mysqli_num_rows($clear_query);
				return $nums ;
}
	?>
	    <link href="css/style2.css" rel="stylesheet"  type="text/css"/>
