<? session_start();  ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	$tips=new mytips();
	$tips->table="ls_config"; 
	 
	//echo $tips->gettips('companyName');
	//$tips->puttips('companyName','hi2 companyName');
	
	require_once('inc/char_set.php');
	
	
function xmlencode($tag){
	$tag = str_replace("&", "&amp;", $tag);
	$tag = str_replace("<", "&lt;", $tag);
	$tag = str_replace(">", "&gt;", $tag);
	$tag = str_replace("'", "&apos;", $tag);
	$tag = str_replace("/", '&quot;', $tag);
	return $tag;
	}
	
function getolddir($content)
{	
	require_once('inc/conn.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	$olddir_sql="select * from ls_products where position('ls_admin' IN ".$content.")>0 ";
	$olddir_query=$opendb->query($olddir_sql);
	$olddir_rows=mysql_fetch_assoc($olddir_query); 
	$olddirstr=$olddir_rows[$content];
	$olddir=substr($olddirstr,0,strpos($olddirstr,'ls_admin'));
	$olddir=substr($olddir,strrpos($olddir,'"')+1).'ls_admin';
	
	return($olddir);
}
/*版权设置*/
		$copyright_post=$_POST['copyright'];
		$config_sql="select * from ls_config ";
		$config_query=$opendb->query($config_sql);
		$config_rows=mysql_fetch_assoc($config_query);
		if($copyright_post=="")
		{
			$copyrightsql="Copyright ©  - ".date("Y")."<a href='index.html'>".$config_rows['companyNameCn']."</a> All Rights Reserved.";
		}
		else 
		{
			$copyrightsql=str_replace("- ","-",$copyright_post);
			$copyrightsql=str_replace("- ","-",$copyrightsql);
			$minpos=strpos($copyrightsql,"-");
			$copyrightsql=substr($copyrightsql,0,$minpos-1)." - ".date("Y")." ".substr($copyrightsql,$minpos+6);
			
		}

/*版权设置结束*/
	$ls=$_POST['ls'];
	$replacedir=$_POST['replacedir'];
	$templates = "";
	file_exists("widget/ls_config_template.php")?$templates = $_POST['select2']:$templates = "Templates1";

	
if($_POST['name_']!='' && $_POST['tel_']!='' && $_POST['sub2']!=''){
	//print_r($_POST);
	$png = new Two($_POST['name_'],$_POST['tel_']);
	if(file_exists('company_logo/logo.jpg')){
		$png->setLogo('company_logo/logo.jpg');
	}
	if(file_exists('company_logo/logo.png')){
		$png->setLogo('company_logo/logo.png');
	}
	
	if($_POST['email_']!=''){
		$png->setEmail($_POST['email_']);
	}
	if($_POST['adr_']!=''){
		$png->setAdr($_POST['adr_']);
	}
	if($_POST['url_']!=''){
		$png->setUrl($_POST['url_']);
	}
	$png->show();
	$msg = true;
	//生成xml文件  er.xml 保存二维码数据 转义符号
	
	$name_ = xmlencode($_POST['name_']);
	$tel_ = xmlencode($_POST['tel_']);
	$email_ = xmlencode($_POST['email_']);
	$adr_ = xmlencode($_POST['adr_']);
	$url_ = xmlencode($_POST['url_']);
	
	$text = '<?xml version="1.0"?>
<body>
	<name>'.$name_.'</name>
	<tel>'.$tel_.'</tel>
	<email>'.$email_.'</email>
	<adr>'.$adr_.'</adr>
	<url>'.$url_.'</url>
</body>';
$handle = fopen('code/er.xml','w+');
if($handle){
	//$xml = simplexml_load_string($text);
	fwrite($handle,$text);
	fclose($handle);
}
	
}

if($_POST['text']!='' && $_POST['sub1']!=''){

	$png = new Two();
	if(file_exists('company_logo/logo.jpg')){
		$png->setLogo('company_logo/logo.jpg');
	}
	if(file_exists('company_logo/logo.png')){
		$png->setLogo('company_logo/logo.png');
	}
	$png->show($_POST['text']);
	$msg = true;
	
	//生成xml文件  er.xml 保存二维码数据
	$text = xmlencode($_POST['text']);
	$text = '<?xml version="1.0"?>
<body>
	<content>'.$text.'</content>
</body>';
$handle = fopen('code/er.xml','w+');
if($handle){
	fwrite($handle,$text);
	fclose($handle);
}
}
	if($_POST['del']!=""){
		if(file_exists('code/2.png')){
			unlink('code/2.png');
			$msg_er =  "<script>alert('删除成功')</script>";
		}
	}
//  end


	if ($ls=="modi")
	{
		$languages = "";
		$language = $_POST['language'];  //获取的多选框的值，为一个数组，通过下面的foreach对数据进行操作
		$languages .= count($language);
		if($language != null){
			foreach($language as $employee_id) {
				$languages .= $employee_id;
			}
		}
		$modi_sql=sprintf("update ls_config set companyNameCn=%s, companyName=%s, siteKeywords=%s, siteDescription=%s, address=%s, tel=%s, fax=%s, email=%s, MSN=%s, feedback=%s, ICP=%s, qq=%s, people=%s, feedbackEmail=%s, bottomMenu=%s, website=%s, templates=%s, email2=%s, email3=%s, email4=%s, tel2=%s, tel3=%s, tel4=%s, MSN2=%s, MSN3=%s, MSN4=%s, skype=%s, skype2=%s, skype3=%s, skype4=%s, facebook=%s, twitter=%s, linkedin=%s, google=%s, pinterest=%s, youtube=%s, language=%s, shieldIP=%s, copyright=%s ",
				GetSQLValueString($_POST['companyNameCn'], "text"),
				GetSQLValueString(str_replace(array("\r\n", "\r", "\n"), "", $_POST['companyName']), "text"),
				GetSQLValueString(str_replace(array("\r\n", "\r", "\n"), "", $_POST['siteKeywords']), "text"),
				GetSQLValueString(str_replace(array("\r\n", "\r", "\n"), "", $_POST['siteDescription']), "text"),
				GetSQLValueString($_POST['address'], "text"),
				GetSQLValueString($_POST['tel'], "text"),
				GetSQLValueString($_POST['fax'], "text"),
				GetSQLValueString($_POST['email'], "text"),
				GetSQLValueString($_POST['MSN'], "text"),
				GetSQLValueString($_POST['feedback'], "text"),
				GetSQLValueString($_POST['ICP'], "text"),
				GetSQLValueString($_POST['qq'], "text"),
				GetSQLValueString($_POST['people'], "text"),
				GetSQLValueString($_POST['feedbackEmail'], "text"),
				GetSQLValueString($_POST['bottomMenu'], "text"),
				GetSQLValueString($_POST['website'], "text"),
				GetSQLValueString($templates, "text"),
				GetSQLValueString($_POST['email2'], "text"),
				GetSQLValueString($_POST['email3'], "text"),
				GetSQLValueString($_POST['email4'], "text"),
				GetSQLValueString($_POST['tel2'], "text"),
				GetSQLValueString($_POST['tel3'], "text"),
				GetSQLValueString($_POST['tel4'], "text"),
				GetSQLValueString($_POST['MSN2'], "text"),
				GetSQLValueString($_POST['MSN3'], "text"),
				GetSQLValueString($_POST['MSN4'], "text"),
				GetSQLValueString($_POST['skype'], "text"),
				GetSQLValueString($_POST['skype2'], "text"),
				GetSQLValueString($_POST['skype3'], "text"),
				GetSQLValueString($_POST['skype4'], "text"),
				GetSQLValueString($_POST['facebook'], "text"),
				GetSQLValueString($_POST['twitter'], "text"),
				GetSQLValueString($_POST['linkedin'], "text"),
				GetSQLValueString($_POST['google'], "text"),
				GetSQLValueString($_POST['pinterest'], "text"),
				GetSQLValueString($_POST['youtube'], "text"),
				GetSQLValueString($languages, "text"),
				GetSQLValueString($_POST['shieldIP'], "text"),
				GetSQLValueString($copyrightsql, "text") 
				
				);
		//echo $modi_sql;
		$modi_query=$opendb->query($modi_sql);
		$modi_mobi_sql=sprintf("update ls_mobiconfig set companyName=%s",
				GetSQLValueString($_POST['mobilecompanyName'], "text")
			);
		//echo $modi_sql;
		//修改禁用词
		$modi_sql1="update ls_banword set banword =  '".$_POST['banword']."'";
		$modi_query1=$opendb->query($modi_sql1);
		$modi_mobi_query=$opendb->query($modi_mobi_sql);
		$ls_msg="修改配制操作成功！";
	}
	if($replacedir=="进行目录整理")
	{
		$currentdir=trim($_POST['currentdir']);
		$olddir=trim($_POST['olddir']);
		$replacedir_sql="update  ls_products set productSpecification=replace(productSpecification,'".$olddir."','".$currentdir."'),   cateBrief=replace(cateBrief,'".$olddir."','".$currentdir."'), cateDetail=replace(cateDetail,'".$olddir."','".$currentdir."'), midcateBrief=replace(midcateBrief,'".$olddir."','".$currentdir."'), midcateDetail=replace(midcateDetail,'".$olddir."','".$currentdir."'), subcateBrief=replace(subcateBrief,'".$olddir."','".$currentdir."'), subcateDetail=replace(subcateDetail,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //产品表目录整理
		
		$replacedir_sql="update  ls_singlepages set pageText=replace(pageText,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //singlepage目录整理
		
		$replacedir_sql="update  ls_article  set articleText =replace(articleText ,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //article目录整理
		
		$replacedir_sql="update   ls_news   set newsText =replace(newsText ,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //news目录整理
		
		 $ls_msg="已经进行了目录整理操作";
	}
	
	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_rows=mysql_fetch_assoc($config_query);
	$olddir=getolddir('productSpecification');
	if($olddir=='ls_admin'){$olddir=getolddir('cateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('cateDetail');}
	if($olddir=='ls_admin'){$olddir=getolddir('midcateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('midcateDetail');}
	if($olddir=='ls_admin'){$olddir=getolddir('subcateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('subcateDetail');}
	//echo $olddir;
	$currentdir=dirname($_SERVER['HTTP_REFERER']);
	
	//内链代码开始
	$in=$_GET['in'];
	
	$id=$_GET['id'];
	$modiid=$_POST['modiid'];
	$scanning=$_GET['scanning'];
	
	$title=trim(str_replace("|","",$_POST['title'])); // 清除| 避免干肉
	$Num=$_POST['Num'];
	$url=strtolower(trim($_POST['url']));
	$nowlinknum=$_GET['Num'];
	
	$pattern = "/^(http:\/\/|https:\/\/).*$/";
	 
	if(!preg_match($pattern,  $url)){
		$memo="内链";
	}else{
		$memo="外链";
	}

	switch ($in)
	{
		case "up":
			$down=$nowlinknum-1;
			$down_sql="update ls_internal set Num=".$nowlinknum." where Num=".$down." ";
			$down_sql2="update ls_internal set Num=Num-1 where id=".$id." ";
			//echo $down_sql;
			$down_query=$opendb->query($down_sql);
			$down_query=$opendb->query($down_sql2);
			$ls_msg="上移操作成功！";
			break;
		case "down":
			$up=$nowlinknum+1;
			$up_sql="update ls_internal set Num=".$nowlinknum." where Num=".$up."  ";
			$up_sql2="update ls_internal set Num=Num+1 where id=".$id." ";
			
			//echo $up_sql;
			$up_query=$opendb->query($up_sql);
			$up_query=$opendb->query($up_sql2);

			$ls_msg="下移操作成功！";

			break;
		case "insert":
			$select_sql2="select * from ls_internal where title='".$title."' ";
			$select_query2=$opendb->query($select_sql2);
			$select_rows2=mysql_num_rows($select_query2); //总数
			if(trim($title)!=""){
				if($select_rows2>0){
					$ls_msg="<script> alert('锚点已经存在 或链接文字为空，请重添加');</script>";
				}else{
					$select_sql2="select * from ls_internal ";
					$select_query2=$opendb->query($select_sql2);
					$select_rows2=mysql_num_rows($select_query2); //总数
	
					$insert_sql="insert into ls_internal(title,url,memo,Num,enable) values ('".$title."','".editorPath('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'], $url)."','".$memo."',".($select_rows2+1).",1)";
					//echo $insert_sql;
					$insert_query=$opendb->query($insert_sql);
	
					$ls_msg="添加操作成功！";
				}
			}
			break;
		case "modi":
			$modi_sql="update ls_internal set memo='".$memo."', title='".$title."',   url='".editorPath('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'], $url)."', memo='".$memo."'  where id=".$modiid." ";
			echo $modi_sql;
			$modi_query=$opendb->query($modi_sql);
			
			$ls_msg="修改操作成功！";
				
			break;
		case "del":
		 
			$link_sql2="select * from ls_internal where id=".$id." ";
			$link_query2=$opendb->query($link_sql2);
			$link_rows2=mysql_fetch_assoc($link_query2);
			$num_sql2="update ls_internal set Num=Num-1 where Num>".$link_rows2['Num']." ";//all order number-1
			$down_query=$opendb->query($num_sql2);
		
			$del_sql="delete from ls_internal where id=".$id." ";
			//echo $del_sql;
			$del_query=$opendb->query($del_sql);
			$ls_msg="删除操作成功！";
			break;
		case "unenable":
			$unenable_sql="update ls_internal set enable=0 where id=".$id." ";
			//echo $unenable_sql;
			$unenable_query=$opendb->query($unenable_sql);
			$ls_msg="禁止操作成功！";
			break;
		case "enable":
			$enable_sql="update ls_internal set enable=1 where id=".$id." ";
			//echo $enable_sql;
			$enable_query=$opendb->query($enable_sql);
			$ls_msg="允许操作成功！";
			break;
	}
	
	if($scanning=="add")
	{
		$in_sql="SELECT * FROM ls_internal where enable=1 order by Num asc"; //count the error by searchtype
		$in_query=$opendb->query($in_sql);
		$internal = array(); //添加过的内链锚点
		$i = -1;
		while ($in_rows=mysql_fetch_assoc($in_query)){
			$i++;
			$internal[$i] = $in_rows['title'];
			$stitle = $in_rows['title'];
			$surl = $in_rows['url'];
			
			$pro_sql = "select * from ls_products where enable = 1 order by Num ";
			$pro_query = $opendb->query($pro_sql);
			while($pro_value = mysql_fetch_array($pro_query)){
				$replacedir_sql=sprintf("update ls_products set productSpecification=%s, characteristics=%s, advantages=%s, parameters=%s, cateBrief=%s, cateDetail=%s, midcateBrief=%s, midcateDetail=%s, subcateBrief=%s, subcateDetail=%s where id=%s",
						GetSQLValueString(internal_keyword_link($pro_value['productSpecification'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['characteristics'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['advantages'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['parameters'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['cateBrief'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['cateDetail'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['midcateBrief'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['midcateDetail'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['subcateBrief'], $stitle, $surl),"text"),
						GetSQLValueString(internal_keyword_link($pro_value['subcateDetail'], $stitle, $surl),"text"),
						GetSQLValueString($pro_value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);
			}
			
			$singlepages_sql = "select * from ls_singlepages where enable = 1 order by Num ";
			$singlepages_query = $opendb->query($singlepages_sql);
			while($value = mysql_fetch_array($singlepages_query)){
				$replacedir_sql=sprintf("update ls_singlepages set pageText=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['pageText'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //singlepage目录整理
			}
			
			$news_sql = "select * from ls_news where enable = 1 order by Num ";
			$news_query = $opendb->query($news_sql);
			while($value = mysql_fetch_array($news_query)){
				$replacedir_sql=sprintf("update   ls_news   set newsText=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['newsText'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //news目录整理
			}
			
			$about_sql="select * from ls_information where inMenu='aboutus' order by ID";
			$about_query=$opendb->query($about_sql);
			$about_row=mysql_fetch_array($about_query);
			$replacedir_sql=sprintf("update   ls_information  set content=%s where inMenu='aboutus' ",
					GetSQLValueString(internal_keyword_link($about_row['content'], $stitle, $surl),"text")
				);
			$replacedir_query=$opendb->query($replacedir_sql);  //aboutus目录整理
			
			$notice_sql="select * from ls_information where inMenu='notice' order by ID";
			$notice_query=$opendb->query($notice_sql);
			$notice_row=mysql_fetch_array($notice_query);
			$replacedir_sql=sprintf("update   ls_information  set content=%s where inMenu='notice' ",
					GetSQLValueString(internal_keyword_link($notice_row['content'], $stitle, $surl),"text")
				);
			$replacedir_query=$opendb->query($replacedir_sql);  //notice目录整理
			
			$menu_sql = "select * from ls_menu where enable = 1 order by menuNum ";
			$menu_query = $opendb->query($menu_sql);
			while($value = mysql_fetch_array($menu_query)){
				$replacedir_sql=sprintf("update   ls_menu   set description=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['description'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //menu目录整理
			}
			
			$workshop_sql = "select * from ls_workshop where enable = 1 order by Num ";
			$workshop_query = $opendb->query($workshop_sql);
			while($value = mysql_fetch_array($workshop_query)){
				$replacedir_sql=sprintf("update   ls_workshop   set workshopText=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['workshopText'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //workshop目录整理
			}
			
			$certificate_sql = "select * from ls_certificate where enable = 1 order by Num ";
			$certificate_query = $opendb->query($certificate_sql);
			while($value = mysql_fetch_array($certificate_query)){
				$replacedir_sql=sprintf("update   ls_certificate   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //certificate目录整理
			}
			
			$qualitycontrol_sql = "select * from ls_qualitycontrol where enable = 1 order by Num ";
			$qualitycontrol_query = $opendb->query($qualitycontrol_sql);
			while($value = mysql_fetch_array($qualitycontrol_query)){
				$replacedir_sql=sprintf("update   ls_qualitycontrol   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //qualitycontrol目录整理
			}
			
			$packing_sql = "select * from ls_packing where enable = 1 order by Num ";
			$packing_query = $opendb->query($packing_sql);
			while($value = mysql_fetch_array($packing_query)){
				$replacedir_sql=sprintf("update   ls_packing   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //packing目录整理
			}
			
			$rd_sql = "select * from ls_rd where enable = 1 order by Num ";
			$rd_query = $opendb->query($rd_sql);
			while($value = mysql_fetch_array($rd_query)){
				$replacedir_sql=sprintf("update   ls_rd   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //rd目录整理
			}
			
			$brand_sql = "select * from ls_brand where enable = 1 order by Num ";
			$brand_query = $opendb->query($brand_sql);
			while($value = mysql_fetch_array($brand_query)){
				$replacedir_sql=sprintf("update   ls_brand   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //brand目录整理
			}
			
			$management_sql = "select * from ls_management where enable = 1 order by Num ";
			$management_query = $opendb->query($management_sql);
			while($value = mysql_fetch_array($management_query)){
				$replacedir_sql=sprintf("update   ls_management   set Text=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['Text'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //management目录整理
			}
			
			$functioncates_sql = "select * from ls_functioncates where enable = 1 order by Num ";
			$functioncates_query = $opendb->query($functioncates_sql);
			while($value = mysql_fetch_array($functioncates_query)){
				$replacedir_sql=sprintf("update   ls_functioncates   set brief=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['brief'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //functioncates目录整理
			}
			
			$article_sql = "select * from ls_article where enable = 1 order by Num ";
			$article_query = $opendb->query($article_sql);
			while($value = mysql_fetch_array($article_query)){
				$replacedir_sql=sprintf("update  ls_article  set articleText=%s where id=%s",
						GetSQLValueString(internal_keyword_link($value['articleText'], $stitle, $surl),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //article目录整理
			}
			
		}
		
		$code_sql = "select * from ls_functioncode where codeID='internal' ";
		$code_query = $opendb->query($code_sql);
		$code_value = mysql_fetch_array($code_query);
		$code = explode(",",$code_value['code']);
		$int_str = "";
		foreach($internal as $in_val){
			$foo = true;
			foreach($code as $code_val){
				if(trim($code_val) == trim($in_val)){
					$foo = false;
				}
			}
			if($foo){
				$int_str .= trim($in_val).",";
			}
		}
		
		$updateint_sql=sprintf("update ls_functioncode set code=%s where codeID=%s",
				GetSQLValueString($code_value['code'].$int_str,"text"),
				GetSQLValueString('internal',"text")
			);
		$updateint_query=$opendb->query($updateint_sql);
		$ls_msg="所有文章已增加内链！";

	}elseif($scanning=="clear"){
		
		$in_sql="select * from ls_functioncode where codeID='internal'"; //count the error by searchtype
		$in_query=$opendb->query($in_sql);
		
		$in_value = mysql_fetch_array($in_query);
		$in_code = explode(",",$in_value['code']);
		
		foreach($in_code as $in_rows){
			$stitle = $in_rows;
			$pro_sql = "select * from ls_products where enable = 1 order by Num ";
			$pro_query = $opendb->query($pro_sql);
			while($pro_value = mysql_fetch_array($pro_query)){
				$replacedir_sql=sprintf("update ls_products set productSpecification=%s, characteristics=%s, advantages=%s, parameters=%s, cateBrief=%s, cateDetail=%s, midcateBrief=%s, midcateDetail=%s, subcateBrief=%s, subcateDetail=%s where id=%s",
						GetSQLValueString(clear_keyword_link($pro_value['productSpecification'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['characteristics'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['advantages'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['parameters'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['cateBrief'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['cateDetail'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['midcateBrief'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['midcateDetail'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['subcateBrief'], $stitle),"text"),
						GetSQLValueString(clear_keyword_link($pro_value['subcateDetail'], $stitle),"text"),
						GetSQLValueString($pro_value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);
			}
			
			$singlepages_sql = "select * from ls_singlepages where enable = 1 order by Num ";
			$singlepages_query = $opendb->query($singlepages_sql);
			while($value = mysql_fetch_array($singlepages_query)){
				$replacedir_sql=sprintf("update ls_singlepages set pageText=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['pageText'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //singlepage目录整理
			}
			
			$news_sql = "select * from ls_news where enable = 1 order by Num ";
			$news_query = $opendb->query($news_sql);
			while($value = mysql_fetch_array($news_query)){
				$replacedir_sql=sprintf("update   ls_news   set newsText=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['newsText'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //news目录整理
			}
			
			$about_sql="select * from ls_information where inMenu='aboutus' order by ID";
			$about_query=$opendb->query($about_sql);
			$about_row=mysql_fetch_array($about_query);
			$replacedir_sql=sprintf("update   ls_information  set content=%s where inMenu='aboutus' ",
					GetSQLValueString(clear_keyword_link($about_row['content'], $stitle),"text")
				);
			$replacedir_query=$opendb->query($replacedir_sql);  //aboutus目录整理
			
			$notice_sql="select * from ls_information where inMenu='notice' order by ID";
			$notice_query=$opendb->query($notice_sql);
			$notice_row=mysql_fetch_array($notice_query);
			$replacedir_sql=sprintf("update   ls_information  set content=%s where inMenu='notice' ",
					GetSQLValueString(clear_keyword_link($notice_row['content'], $stitle),"text")
				);
			$replacedir_query=$opendb->query($replacedir_sql);  //notice目录整理
			
			$menu_sql = "select * from ls_menu where enable = 1 order by menuNum ";
			$menu_query = $opendb->query($menu_sql);
			while($value = mysql_fetch_array($menu_query)){
				$replacedir_sql=sprintf("update   ls_menu   set description=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['description'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //menu目录整理
			}
			
			$workshop_sql = "select * from ls_workshop where enable = 1 order by Num ";
			$workshop_query = $opendb->query($workshop_sql);
			while($value = mysql_fetch_array($workshop_query)){
				$replacedir_sql=sprintf("update   ls_workshop   set workshopText=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['workshopText'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //workshop目录整理
			}
			
			$certificate_sql = "select * from ls_certificate where enable = 1 order by Num ";
			$certificate_query = $opendb->query($certificate_sql);
			while($value = mysql_fetch_array($certificate_query)){
				$replacedir_sql=sprintf("update   ls_certificate   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //certificate目录整理
			}
			
			$qualitycontrol_sql = "select * from ls_qualitycontrol where enable = 1 order by Num ";
			$qualitycontrol_query = $opendb->query($qualitycontrol_sql);
			while($value = mysql_fetch_array($qualitycontrol_query)){
				$replacedir_sql=sprintf("update   ls_qualitycontrol   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //qualitycontrol目录整理
			}
			
			$packing_sql = "select * from ls_packing where enable = 1 order by Num ";
			$packing_query = $opendb->query($packing_sql);
			while($value = mysql_fetch_array($packing_query)){
				$replacedir_sql=sprintf("update   ls_packing   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //packing目录整理
			}
			
			$rd_sql = "select * from ls_rd where enable = 1 order by Num ";
			$rd_query = $opendb->query($rd_sql);
			while($value = mysql_fetch_array($rd_query)){
				$replacedir_sql=sprintf("update   ls_rd   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //rd目录整理
			}
			
			$brand_sql = "select * from ls_brand where enable = 1 order by Num ";
			$brand_query = $opendb->query($brand_sql);
			while($value = mysql_fetch_array($brand_query)){
				$replacedir_sql=sprintf("update   ls_brand   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //brand目录整理
			}
			
			$management_sql = "select * from ls_management where enable = 1 order by Num ";
			$management_query = $opendb->query($management_sql);
			while($value = mysql_fetch_array($management_query)){
				$replacedir_sql=sprintf("update   ls_management   set Text=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['Text'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //management目录整理
			}
			
			$functioncates_sql = "select * from ls_functioncates where enable = 1 order by Num ";
			$functioncates_query = $opendb->query($functioncates_sql);
			while($value = mysql_fetch_array($functioncates_query)){
				$replacedir_sql=sprintf("update   ls_functioncates   set brief=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['brief'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //functioncates目录整理
			}
			
			$article_sql = "select * from ls_article where enable = 1 order by Num ";
			$article_query = $opendb->query($article_sql);
			while($value = mysql_fetch_array($article_query)){
				$replacedir_sql=sprintf("update  ls_article  set articleText=%s where id=%s",
						GetSQLValueString(clear_keyword_link($value['articleText'], $stitle),"text"),
						GetSQLValueString($value['ID'],"int")
					);
				$replacedir_query=$opendb->query($replacedir_sql);  //article目录整理
			}
		}
		$ls_msg="已清除所有文章内链！";

	}
	
	$select_sql2="select * from ls_internal ";
	$select_query2=$opendb->query($select_sql2);
	$link_num=mysql_num_rows($select_query2); //总数
	
	$in_sql="SELECT * FROM ls_internal order by Num asc"; //count the error by searchtype
	$in_query=$opendb->query($in_sql);
	//内链代码结束
	
	$config_mobi_sql="select * from ls_mobiconfig ";
	$config_mobi_query=$opendb->query($config_mobi_sql);
	$config_mobi_rows=mysql_fetch_assoc($config_mobi_query);
	
	if($_GET['mess']!="")$ls_msg=$_GET['mess'];
	if(!(strpos($ls_msg,"内链")===false)){
		$myanchor="interlink";

	}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/admin.css" rel="stylesheet" type="text/css">
<link href="css/newui.css" rel="stylesheet" type="text/css">
   <link rel="stylesheet" href="css/style2.css" />
<SCRIPT type=text/javascript src="js/ls2.js"></SCRIPT>
<style type="text/css"> 
div,ul,li {margin:0;padding:0;}
ul{list-style-type:none;}
#fo li{ width:350px;}
#tul{list-style-type:none;width:240px;background:#D6DFF7;margin-bottom:30px;}
#tul:after{content:".";display:block;clear:both;line-height:0px;height:0;visibility:hidden;}
.tul li { width:50%; height:30px; line-height:30px; text-align:center; color:#0c3d66;background:#e3e6ed; font-size:14px; float:left;  color:#2064ae;cursor: hand;!important;cursor: pointer}
.tul .check { background:white;font-weight: bold; } 
.slist { width:350px; height:170px;margin:auto;}
#cont{
	width:380px;
	height:250px;
	border:1px solid gray;
}
#nei{
	clear:both;
	width:360px;
	height:100px;
	padding:10px;
}
</style> 
<script type="text/javascript" src="js/jquery.js"></script>
<script language="JavaScript" src="js/ls.js"></script>
<script type="text/javascript">
	function setInnerHTML(){
		var path1 = document.getElementById("select2").value;
		document.getElementById("img1").innerHTML="<img src='../"+path1+"/"+path1+".jpg' width='400' />";
	}
    
    jQuery(document).ready(function(){
        jQuery('.tul li').click(
                function(){
                        jQuery(this).siblings().removeClass("check");
                        jQuery(this).addClass("check");
                        var tid = "#" + jQuery(this).attr('id') + "_cont";
                        jQuery(tid).siblings().hide();
                        jQuery(tid).show();
                        
                },
                function(){}
        );
});
	
</script>
<script language="javascript"> 
function keypress2() //textarea输入长度处理 
{
var text1=document.getElementById("siteDescription").value;
var text2=document.getElementById("siteKeywords").value;
var text3=document.getElementById("companyName").value;
var text4=document.getElementById("mobilecompanyName").value;

var len;//记录剩余字符串的长度
var len2;
var len3;
var len4;
if(text2.length>=244 || text1.length>=155 || text3.length>=55 || text4.length>=40)//textarea控件不能用maxlength属性，就通过这样显示输入字符数了 
{
len=244-(text2.length);
len2=155-(text1.length); 
len3=55-(text3.length); 
len4=40-(text4.length); 
} 
else 
{ 
len=244-(text2.length);
len2=155-(text1.length); 
len3=55-(text3.length); 
len4=40-(text4.length); 
} 
var show="还可输"+len+"个";
var show2="还可输"+len2+"个"; 
var show3="还可输"+len3+"个"; 
var show4="还可输"+len4+"个"; 
document.getElementById("pinglun").innerText=show;
document.getElementById("pinglun2").innerText=show2;
document.getElementById("pinglun3").innerText=show3;
document.getElementById("pinglun4").innerText=show4;
} 

</script>
<script type="text/javascript">
function internal(operation){
	var action = "ls_internal.php?action="+operation;
	$.ajax({
		type: "POST",
		url: action,
		error: function(request) {
		},
		success: function(response)
		{
			if(response == "repeat"){
				alert("链接已经存在 或链接文字为空。");
			}else{
				if(response == "fail"){
					//alert("自动添加失败");
				}else{
					//alert("自动添加成功");
					window.location.href="ls_config.php?mess="+response;
				}
			}
		}
	});
}

window.onload=function(){
  location.hash='<?=$myanchor?>';
}

</script>
</head>
<body>
<? echo $msg_er;?>
<table width="100%" border="0" cellpadding="3" cellspacing="1">
	<tr>
        <td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">系统配置与优化</font></div>
				</td>
	</tr>
	<tr>
		<td align="center" ><form name="fmconfig" method="post" enctype="multipart/form-data"  action="ls_config.php">
			<input type="hidden" name="ls" value="modi" />
			<table width="98%" border="0" style="margin-top:16px;">
				<tr>
					<td colspan="2" style="padding-left:20px;"> 提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
					<td width="26%" colspan="2">
                       <?php if($googleTrans){ ?>
                       其他语种优化设置
                      <select name="selecttype3" id="selecttype2"  onchange='window.open("ls_config_ml.php?id=<?=$id?>&enTag=ls_config&lang="+this.value.replace("../","") ,"newwindow","width=800,height=700,menubar=no,toolbar=no, status=no,scrollbars=yes");'>
                        <!-- new_window = window.open(); open_window(  -->
                        <?php  file_exists("widget/menulangs.php")?include "widget/menulangs.php":""  ?>
                    </select>
                        <?php } ?>
                    </td>
				</tr>
				<tr>
			</table>
			<table width="98%" border="0" cellpadding="16" cellspacing="0" style=" margin-bottom:20px; background-color: #f0f0ee;">
		  <tr>
				<td  width="50%" colspan="2"><fieldset class="infofield" >
						<legend><strong>SEO优化</strong></legend>
						<table width="96%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="25%" align="right">公司名称：</td>
								<td width="75%"><textarea name="companyNameCn" class="inputareashort" style="height:55px;" ><?php echo $config_rows['companyNameCn'];?></textarea>
								 <button type="" value="?" class=""   id="button3"  <?=$tipsWr?"onclick=\"opentip( 'companyName','标题Title')\"; ":"onclick=\"opentip( 'companyName')\";"?> >?</button>
                                 <script type="text/javascript">
								  //实现弹出窗口的方法
								  function opentip(str1,str3=""){
								  window.open("tipswr.php?title="+str1+(str3==""?"":"&disp="+str3),"", "width=<?=$tipsWr?"700":"500"?>,height=<?=$tipsWr?"400":"400"?>,left="+($('#button3').offset().left+66)+",top="+($('#button3').offset().top+116) );
								  }
								  </script>		       
                                  
								  		
                              <br /></td>
						  </tr>
							<tr>
								<td height="69" align="right">首页标题：<br />
								Title<br /></td>
							  <td><textarea name="companyName" id="companyName" class="inputareashort" style="height:55px;" onKeyUp="keypress2()" onBlur="keypress2()"><?php echo $config_rows['companyName'];?></textarea></td>
						  </tr>
                          <tr>
							  <td colspan="2" align="right" style="padding-right:18px;">最多55个字符（25汉字），<font color="#FF0000">
				              <label id="pinglun3">还可输55个</label>
							  </font></td>
						  </tr>
                            <tr>
								<td align="right">手机标题：<br />
							    Title</td>
								<td><textarea name="mobilecompanyName" id="mobilecompanyName" class="inputareashort" style="height:55px;" onKeyUp="keypress2()" onBlur="keypress2()"><?php echo $config_mobi_rows['companyName'];?></textarea></td>
							</tr>
                            <tr>
							  <td colspan="2" align="right" style="padding-right:18px;">最多40个字符（20汉字），<font color="#FF0000">
				              <label id="pinglun4">还可输40个</label>
							  </font></td>
							</tr>
				  </table>
					</fieldset></td>
				<td width="50%" colspan="2"><fieldset class="infofield"  >
				  <legend><strong>SEO优化</strong></legend>
						<table width="96%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="25%" align="right" ><br />
									首页关键字：<br />
									Keywords</td>
								<td width="75%"><textarea name="siteKeywords" id="siteKeywords" class="inputareashort" onKeyUp="keypress2()" onBlur="keypress2()" ><?php echo $config_rows['siteKeywords'];?></textarea></td>
							</tr>
                            <tr>
							  <td colspan="2" align="right" style="padding-right:18px;" >最多 244个字符，<font color="#FF0000">
				              <label id="pinglun">还可输244个</label>
							  </font></td>
							</tr>
							<tr>
								<td align="right">首页描述：<br />
									Description</td>
								<td><textarea name="siteDescription" id="siteDescription" class="inputareashort" onKeyUp="keypress2()" onBlur="keypress2()" ><?php echo $config_rows['siteDescription'];?></textarea></td>
							</tr>
                            <tr>
							  <td colspan="2" align="right" style="padding-right:18px;" >最多155个字符，<font color="#FF0000">
				              <label id="pinglun2">还可输155个</label>
							  </font></td>
							</tr>
						</table>
					</fieldset></td>
			</tr>
            <script> keypress2();</script>
			<tr>
				<td colspan="4"><fieldset class="communfield"  >
				  <legend>基本信息</legend>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<!--<tr>
								<td width="160" height="32" align="right">Tel（电话）： </td>
								<td width="240" align="left"><input type="text" value="<?php echo $config_rows['tel'];?>" name="tel" class="ifinfoinputshort"  onblur="writetel(this);"  ></td>
								<td width="160" align="right">Fax（传真）：</td>
								<td width="240"><input type="text" onblur="write2()" value="<?php echo $config_rows['fax'];?>" name="fax" class="ifinfoinputshort" /></td>
							</tr>
							<tr>
								<td align="right" height="32">E-Mail（网站邮箱）：</td>
								<td align="left"><input type="text" id="email" value="<?php echo $config_rows['email'];?>" name="email" class="ifinfoinputshort"   onblur="this.form.feedbackEmail.value==''?this.form.feedbackEmail.value=this.value:''; writeemail(this);"  /></td>
								<td align="right">MSN：</td>
								<td><input type="text" value="<?php echo $config_rows['MSN'];?>" name="MSN" class="ifinfoinputshort"    /></td>
							</tr>-->
							<tr>
								<td width="99" height="54" align="right">反馈邮箱：
                              </td>
							  <td width="237" align="left"><input type="text" value="<?php echo $config_rows['feedbackEmail'];?>" name="feedbackEmail" class="ifinfoinputshort"    /></td>
							  <td width="403"  style="padding-left:4px;">品牌：
							    <input type="text" value="<?php echo $config_rows['MSN4'];?>" name="MSN4" class="ifinfoinputshort" /> 
							  (多品牌逗号分)</td> <td width="403"  style="padding-left:4px;">核心词：
							    <input type="text" value="<?php echo $config_rows['MSN3'];?>" name="MSN3" class="ifinfoinputshort" /></td>
                          <tr style="margin-top:20px;">
		<td height="48" align="right">版权设置： </td>
		<td colspan="3"><input name="copyright" type="text" value="<?=trim($config_rows['copyright'])==""?"Copyright ©  - ".date("Y")."<a href='index.html'>".$config_rows['companyNameCn']."</a> All Rights Reserved." : trim($config_rows['copyright'])?>" size="131" />&nbsp;</td>
		<td width="4">&nbsp;</td>


                          </tr>
  
    <tr>
      <td colspan="3"></td> 
      <td colspan="3"><div class="lsconeditorarea2" align="right"><button type="submit" value="保存" class="submitbuttonsf4">保存</button></div></td>
    </tr>
    
    		</table>
						<table width="95%" height="80" border="0" align="right" cellpadding="0" cellspacing="0" id="notmust" style="DISPLAY:none ; " >
<tr>
								<td width="120" align="right">Tel 2： </td>
								<td width="162" align="left"><input type="text" value="<?php echo $config_rows['tel2'];?>" name="tel2" class="ifinfoinputshort2" /></td>
								
						  </tr>
							<tr>
								<td align="right">Email 2： </td>
								<td align="left"><input type="text" value="<?php echo $config_rows['email2'];?>" name="email2" class="ifinfoinputshort2" /></td>
								<td align="right">Email 3： </td>
								<td align="left"><input type="text" value="<?php echo $config_rows['email3'];?>" name="email3" class="ifinfoinputshort2" /></td>
								<td align="right">Email 4：</td>
								<td align="left"><input type="text" value="<?php echo $config_rows['email4'];?>" name="email4" class="ifinfoinputshort2" /></td>
							</tr>
							<tr>
								<td align="right">MSN 2： </td>
								<td align="left"><input type="text" value="<?php echo $config_rows['MSN2'];?>" name="MSN2" class="ifinfoinputshort2" /></td>
								
							</tr>
							<tr>
								<td align="right">Skype 2： </td>
								<td align="left"><input type="text" value="<?php echo $config_rows['skype2'];?>" name="skype2" class="ifinfoinputshort2" /></td>
								<td align="right">Skype 3： </td>
								<td align="left"><input type="text" value="<?php echo $config_rows['skype3'];?>" name="skype3" class="ifinfoinputshort2" /></td>
								<td align="right">Skype 4：</td>
								<td align="left"><input type="text" value="<?php echo $config_rows['skype4'];?>" name="skype4" class="ifinfoinputshort2" /></td>
							</tr>
				  </table>
					</fieldset>
					 
			  </td>
	</tr>
	 		 <?php file_exists("widget/ls_language.php")?include '<tr><td colspan="4">'."widget/ls_language.php".'</td></tr>':"" ?> 
   <tr>
	<td colspan="4">
    
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
	<tbody><tr>
		<td width="50%">
			<?php file_exists("widget/ls_shieldIP.php")?include "widget/ls_shieldIP.php":"" ?>
		</td>
		<td width="50%" height="193">
			   <?php file_exists("widget/ls_banwords.php")?include "widget/ls_banwords.php":"" ?>

		</td>
	</tr>
</tbody></table>
	
	</td>
    </tr>
    
	<tr>
	<td colspan="4">
	<?php file_exists("widget/ls_config_weibo.php")?include "widget/ls_config_weibo.php":"" ?>
	</td>
	</tr>
	<tr>
		 <?php file_exists("widget/ls_config_template.php")?include '<tr><td colspan="4">'."widget/ls_config_template.php".'</td></tr>':"" ?> 
	
		<?php file_exists("widget/ls_config_feedback.php")?include '<tr><td colspan="4">'."widget/ls_config_feedback.php".'</td></tr>':""  ?>
	
    <tr>
		<td colspan="4" align="center" style="padding-bottom:18px;"><div class="lsconeditorarea2" align=""><font color="#FF0000"><a name="interlink" id="interlink"></a></font>
		  <button type="submit" value="保存" class="submitbuttonsf4">保存</button></div></td>
	</tr>
</table>
</form>
</td>
</tr>
 <table width="100%">
	<tr>
        <td height="379" style="padding-top:10px;" ><table width="98%" border="0" align="center" style="margin-top:16px;">
          <tr>
            <td colspan="2" style="padding-left:20px;"> 提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
            <td width="402" colspan="2">&nbsp;</td>
          </tr>
          <tr></tr>
        </table>
          <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1"style="background-color: #f0f0ee;"> 
          <tr bgcolor="#f0f0ee">
            <td align="center" colspan="9" height="37"><b>内部链接优化</b></td>
          </tr>
          <tr bgcolor="#f0f0ee" height="37">
            <td align="center" width="38" height="28">序号</td>
            <td align="center" width="360" height="28">关键词（锚点）</td>
            <td width="293" align="center">链接网址</td>
            <td width="100" align="center">说明</td>
            <td colspan="2" align="center">排序</td>
            <td width="39" align="center" >操作</td>
            <td width="39" align="center" >删除</td>
            <td  width="39" align="center">允许</td>
          </tr>
          <?php 
		  $i=1;
		  while ($link_rows=mysql_fetch_assoc($in_query))
		  { ?>
          <tbody id='ZH_<?=$link_rows['ID']?>' >
            <tr bgcolor='#f9f9f9' height='37'
						onMouseOver=
						 	this.style.backgroundColor='#e5e5e5' 
						onMouseOut=
						 	this.style.backgroundColor='#f9f9f9' 
						>
              <td align='left' style='padding-left:10px;' height='25' ><?=$i?></td>
              <td align='left' style='padding-left:10px;' height='25' ><?=$link_rows['title']?></td>
              <td align='left' style='padding-left:10px;' height='25'><a href="<?=$link_rows['url']?>" target="_blank"><?=$link_rows['url']?></a></td>
              <td align='left' style='padding-left:10px;' height='25'><?=trim($link_rows['memo'])?></td>
              <td width="48" align='center'><?
						if($i!=1)// not start up
						{?>
                <a href='?page=<?=$page?>&id=<?=$link_rows['ID']?>&Num=<?=$link_rows['Num']?>&in=up&selectcate=<?=$selectcate?>' title='向上移动'><img src='images/up.gif' border='0'></a>
                <? } ?></td>
              <td width="49" align='center'><? 
						if($i!=$link_num)// not end down
						{ ?>
                <a href='?page=<?=$page?>&id=<?=$link_rows['ID']?>&Num=<?=$link_rows['Num']?>&in=down&selectcate=<?=$selectcate?>' title='向下移动'><img src='images/down.gif' border='0'></a>
                <? } ?></td>
              <td align='center'><a href='javascript:secBoard(<?=$link_rows['ID']?>)' title='编辑'><img src='images/b_edit.png' border='0' /></a></td>
              <td align='center'> 
                <a href='?page=<?=$page?>&id=<?=$link_rows['ID']?>&in=del&selectcate=<?=$selectcate?>' onclick='return ConfirmDel();' title='删除'><img src='images/b_drop.png' border='0'></a>
              </td>
              <td align='center'><?   if($link_rows['enable']==1)
							{ ?>
                <a href='?page=<?=$page?>&id=<?=$link_rows['ID']?>&in=unenable&selectcate=<?=$selectcate?>' title='显示'><img src='images/enable.gif' border='0'></a>
                <? }
						  if($link_rows['enable']==0)
						  	{ ?>
                <a href='?page=<?=$page?>&id=<?=$link_rows['ID']?>&in=enable&selectcate=<?=$selectcate?>' title='不显示'><img src='images/unenable.gif' border='0'></a>
                <?	} ?></td>
            </tr>
          </tbody>
          <tbody id='Z_<?=$link_rows['ID']?>' style='display:none;'>
      <form name='fm_link' action='?in=modi' enctype='multipart/form-data' method='post'>
        <tr bgcolor='#f4f4f4'>
            <td align='left' style='padding-left:10px;' height='25' ><?=$i?></td>
            <td align='left' style='padding-left:10px;' height='25' ><input name='title' type='text' class='inp' value='<?=$link_rows['title']?>' style="width:100%;" ></td>
            <td align='left' style='padding-left:5px;' height='25'><input name='url' type='text' class='inp' value='<?=$link_rows['url']?>' style="width:100%;" ></td>
            <td align='left' style='padding-left:5px;' height='25'>&nbsp;</td>
            <td colspan='5' align='center'><input value='<?=$link_rows['ID']?>' name='modiid' type='hidden'>
              <button type='submit' value='保存'>保存</button>
              <button type='button' onclick='javascript:secBoard2(<?=$link_rows['ID']?>)' value='放弃'>放弃</button></td>
          </tr>
      </form>
      </tbody>
      <?
      $i++;
	  }
	 ?>
</table>
<form name="fmaddlink" action="?in=insert" enctype="multipart/form-data" method="post" onSubmit="return Checkaddlink();" style="margin-bottom:0px;">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0"style="background-color: #f0f0ee;">
            <tr bgcolor="#f4f4f4" height="47">
              <td width="8%" align="right" >关键词</td>
              <td width="27%" height="28" ><input name="title" type="text" style="width:90%;" size="40" /></td>
              <td width="10%" align="left" >不能有 | 和 ，</td>
              <td width="8%" align="right" >链接网址</td>
              <td width="38%" height="28" ><input name="url" type="text"  value="" style="width:90%;" /></td>
              <td width="9%" height="28" align="center" ><button type="submit" value="增加" />增加</button></td>
            </tr>
        </table>
          </form>
          <br />
         
          <form name="fmin" method="post" action="">
          <table width="98%" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
    	<tr>
           <td colspan="5" align="center" height="60"> <input type="button" name="button2" id="button2" value="清除上述链接关键词" style="height:40px;background-color:#C33; color:#FFF; border:0px; cursor:pointer;" onclick="
              if(confirm('您确定要清除链接关键词吗？')){
                internal('clear');
            }else{
                return false;
            }"/> 
             <input type="button" name="button" id="button" value="分析首页获得关键词" style="height:40px;background-color:#390; color:#FFF; border:0px; cursor:pointer;" onclick="
              if(confirm('您确定要获得首页关键词，作为内链关键词吗？完成后，请手工修改这些关键词对应链接？')){
                internal('add');
            }else{
                return false;
            }"/>&nbsp;&nbsp;
             <input type="button" name="subscanning" value="清除自动添加的内链" style="height:40px;background-color:#C30; color:#FFF; border:0px; cursor:pointer;"  onclick="
              if(confirm('您确定要扫描全部网站文章中，清除以前自动添加的关键词内链吗？')){
                window.location.href='?scanning=clear';
            }else{
                return false;
            }"/>
<input type="button" name="subscanning2" value="为网站内容增加内链" style="height:40px;background-color:#090; color:#FFF; border:0px; cursor:pointer;"  onclick="
              if(confirm('您确定要扫描网站内容，对其中的关键词加上内链吗？')){
                window.location.href='?scanning=add';
            }else{
                return false;
            }"/>
            &nbsp;</td>
         </tr>
         <tr >
              <td height='25' colspan="5" align='center' style='padding-left:10px;' >注1： “分析首页获得关键词”将扫描首页SEO设置中的标题（Title）和关键词设置（mate keywords）中的关键词，<br />
            注2： “为网站内容增加内链” 将扫描站内全部文章（产品详页、文章详页、关于我们、单页等），对关键词加链接。</td>
          </tr>
    </table>
  	<br />
  </form>
</td>
</tr>
</table>
</body>
</html>
