<?php
/*
'**************************************************************************************************
' 软件名称: 盘锦DJ舞曲网CMS Content Management PjRen.Net
' 版本编号: Version 2.5
' 盘锦舞曲: http://www.pj57.com
' 官方网站: http://www.pjren.net
' 小说网站: http://www.hx39.com
' 0427DJ网: http://www.0427dj.net
' 官方论坛: http://www.tianjiazhen.com
' 版权所有: 盘锦舞曲开发团队    盘锦人(QQ:814006710)
' 郑重声明:
'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    2、盘锦网络事业部保留此软件的法律追究权利
'**************************************************************************************************
*/
include "../../../include/conn.php";
include "../../../include/function.php";
include "../../admin_version.php";
include "../../admin_loginstate.php";
include "fun.php";
$action=SafeRequest("action","get");
$id=SafeRequest("s_id","get");
switch($action){
	case 'exp':
		main($id);
		break;
	case 'imp':
		imp();
		break;
	case 'save':
		save();
		break;
	case 'upload':
		upload();
		break;
	default:
		main($id);
	}	
 function save(){
	 $content=SafeRequest("content","post");
	 $sname=SafeRequest("sname","post");
	 fwrite(fopen("rule/".$sname.".txt","wb"),$content);
	 die("<script>window.location='admin_rulesave.php?sname=$sname'</script>");
	 }
	 
function upload(){
	global $db;
	$mode=SafeRequest("mode","get");
	if($mode=='1'){
		$fileType=array('text','txt');
		$maxSize=800; //单位：KB
		if(!in_array(substr($_FILES['file1']['name'],-3,3),$fileType)) die("<script>alert('不允许上传该类型的文件！-808');history.back();</script>");
		if(strpos($_FILES['file1']['type'],'text')===false) die("<script>alert('不允许上传该类型的文件！');history.back();</script>");	
		if($_FILES['file1']['size']> $maxSize*1024) die( "<script>alert('文件过大！');history.back();</script>");
		if($_FILES['file1']['error'] !=0) die("<script>alert('未知错误，文件上传失败！');history.back();</script>");
		$filename="rule/".date("YmdHis").".txt";
		if(function_exists('move_uploaded_file')){
			move_uploaded_file($_FILES['file1']['tmp_name'],$filename);
			dealRule($filename);
			echo "上传成功!!";
			}
		else{
			@copy($_FILES['file1']['tmp_name'],$filename);
			dealRule($filename);		
			echo "上传成功!!";
		}	
		}
	 else{
		$text=SafeRequest("content","post");
		$S_Name=getContent($text,"<s_name>","</s_name>",5);
		$S_Url=getContent($text,"<s_url>","</s_url>",5);
		$S_Code=getContent($text,"<s_code>","</s_code>",5);
		$S_Source=getContent($text,"<s_source>","</s_source>",5);
		$S_Page=getContent($text,"<s_page>","</s_page>",5);
		$S_UrlStr=getContent($text,"<s_urlstr>","</s_urlstr>",5);
		$S_PageGo=getContent($text,"<s_pagego>","</s_pagego>",5);
		$S_PageEnd=getContent($text,"<s_pageend>","</s_pageend>",5);
		$S_Order=getContent($text,"<s_order>","</s_order>",5);
		$S_AutoSave=getContent($text,"<s_autosave>","</s_autosave>",5);
		$S_SavePic=getContent($text,"<s_savepic>","</s_savepic>",5);
		$S_Safe=getContent($text,"<s_safe>","</s_safe>",5);
		$S_ListGo=getContent($text,"<s_listgo>","</s_listgo>",5);
		$S_ListEnd=getContent($text,"<s_listend>","</s_listend>",5);
		$S_LinkGo=getContent($text,"<s_linkgo>","</s_linkgo>",5);
		$S_LinkEnd=getContent($text,"<s_linkend>","</s_linkend>",5);
		$S_VideoNameGo=getContent($text,"<s_videonamego>","</s_videonamego>",5);
		$S_VideoNameEnd=getContent($text,"<s_videonameend>","</s_videonameend>",5); 
		$S_RemarkGo=getContent($text,"<s_remarkgo>","</s_remarkgo>",5); 
		$S_RemarkEnd=getContent($text,"<s_remarkend>","</s_remarkend>",5); 
		$S_DirectGo=getContent($text,"<s_directgo>","</s_directgo>",5); 
		$S_DirectEnd=getContent($text,"<s_directend>","</s_directend>",5); 
		$S_YearGo=getContent($text,"<s_yeargo>","</s_yeargo>",5); 
		$S_YearEnd=getContent($text,"<s_yearend>","</s_yearend>",5); 
		$S_AuthorGo=getContent($text,"<s_authorgo>","</s_authorgo>",5); 
		$S_AuthorEnd=getContent($text,"<s_authorend>","</s_authorend>",5); 
		$S_AreaMode=getContent($text,"<s_areamode>","</s_areamode>",5); 
		$S_AreaName=getContent($text,"<s_areaname>","</s_areaname>",5); 
		$S_AreaGo=getContent($text,"<s_areago>","</s_areago>",5); 
		$S_AreaEnd=getContent($text,"<s_areaend>","</s_areaend>",5); 
		$S_PicGo=getContent($text,"<s_picgo>","</s_picgo>",5); 
		$S_PicEnd=getContent($text,"<s_picend>","</s_picend>",5); 
		$S_LanguageMode=getContent($text,"<s_languagemode>","</s_languagemode>",5); 
		$S_LanguageName=getContent($text,"<s_languagename>","</s_languagename>",5); 
		$S_LanguageGo=getContent($text,"<s_languagego>","</s_languagego>",5); 
		$S_LanguageEnd=getContent($text,"<s_languageend>","</s_languageend>",5); 
		$S_ClassMode=getContent($text,"<s_classmode>","</s_classmode>",5);
		$S_ClassID=getContent($text,"<s_classid>","</s_classid>",5);
		$S_ClassGo=getContent($text,"<s_classgo>","</s_classgo>",5);
		$S_ClassEnd=getContent($text,"<s_classend>","</s_classend>",5);
		$S_ContentGo=getContent($text,"<s_contentgo>","</s_contentgo>",5);
		$S_ContentEnd=getContent($text,"<s_contentend>","</s_contentend>",5);
		$S_PlayUrlGo=getContent($text,"<s_playurlgo>","</s_playurlgo>",5);
		$S_PlayUrlEnd=getContent($text,"<s_playurlend>","</s_playurlend>",5);
		$S_AddGo=getContent($text,"<s_addgo>","</s_addgo>",5);
		$S_AddEnd=getContent($text,"<s_addend>","</s_addend>",5);
		$S_AddMode=getContent($text,"<s_addmode>","</s_addmode>",5);
		$S_AddOldStr=getContent($text,"<s_addoldstr>","</s_addoldstr>",5);
		$S_AddNewStr=getContent($text,"<s_addnewstr>","</s_addnewstr>",5);
		$S_AddTime=getContent($text,"<s_addtime>","</s_addtime>",5);
		$S_Replace=getContent($text,"<s_replace>","</s_replace>",5);
		$S_PlayUrlMode=getContent($text,"<s_playurlmode>","</s_playurlmode>",5);
		$S_AddPath=getContent($text,"<s_addpath>","</s_addpath>",5);
		$S_AddTime=date("Y-m-d H:i:s");
		if(!IsNum($S_PageGo)) $S_PageGo=1;
		if(!IsNum($S_PageEnd)) $S_PageEnd=1;
		if(!IsNum($S_AutoSave)) $S_AutoSave=0;
		if(!IsNum($S_SavePic)) $S_SavePic=0;	
 		 $sql="insert s_custom (S_Name,S_Url,S_Code,S_Source,S_Page,S_UrlStr,S_PageGo,S_PageEnd,S_Order,S_AutoSave,S_SavePic,S_Safe,S_ListGO,S_ListEnd,S_LinkGo,S_LinkEnd,S_VideoNameGo,S_VideoNameEnd,S_RemarkGo,S_RemarkEnd,S_DirectGo,S_DirectEnd,S_YearGO,S_YearEnd,S_AuthorGo,S_AuthorEnd,S_AreaMode,S_AreaName,S_AreaGo,S_AreaEnd,S_PicGo,S_PicEnd,S_LanguageMode,S_LanguageName,S_LanguageGo,S_LanguageEnd,S_ClassMode,S_ClassID,S_ClassGo,S_ClassEnd,S_ContentGo,S_ContentEnd,S_PlayUrlGo,S_PlayUrlEnd,S_AddGo,S_AddEnd,S_AddMode,S_AddOldStr,S_AddNewStr,S_AddTime,S_Replace,S_PlayUrlMode,S_AddPath) values ('$S_Name','$S_Url','$S_Code','$S_Source','$S_Page','$S_UrlStr','$S_PageGo','$S_PageEnd','$S_Order','$S_AutoSave','$S_SavePic','$S_Safe','$S_ListGo','$S_ListEnd','$S_LinkGo','$S_LinkEnd','$S_VideoNameGo','$S_VideoNameEnd' ,'$S_RemarkGo','$S_RemarkEnd','$S_DirectGo','$S_DirectEnd','$S_YearGo','$S_YearEnd','$S_AuthorGo','$S_AuthorEnd','$S_AreaMode','$S_AreaName','$S_AreaGo','$S_AreaEnd','$S_PicGo','$S_PicEnd','$S_LanguageMode','$S_LanguageName','$S_LanguageGo','$S_LanguageEnd','$S_ClassMode','$S_ClassID','$S_ClassGo','$S_ClassEnd','$S_ContentGo','$S_ContentEnd','$S_PlayUrlGo','$S_PlayUrlEnd','$S_AddGo','$S_AddEnd','$S_AddMode','$S_AddOldStr','$S_AddNewStr','$S_AddTime','$S_Replace','$S_PlayUrlMode','$S_AddPath')";	
		 //die($sql);
		   if($db->query($sql)){
	 		 echo("规则数据导入成功");
	 		 }
 			else{
			 echo("规则数据导入失败");
	 			}	
		}	 
	 }	 

function dealRule($file){
	global $db;
	if(file_exists($file)){
		$text=file_get_contents($file);
		$text=addslashes($text);
		$S_Name=getContent($text,"<s_name>","</s_name>",5);
		$S_Url=getContent($text,"<s_url>","</s_url>",5);
		$S_Code=getContent($text,"<s_code>","</s_code>",5);
		$S_Source=getContent($text,"<s_source>","</s_source>",5);
		$S_Page=getContent($text,"<s_page>","</s_page>",5);
		$S_UrlStr=getContent($text,"<s_urlstr>","</s_urlstr>",5);
		$S_PageGo=getContent($text,"<s_pagego>","</s_pagego>",5);
		$S_PageEnd=getContent($text,"<s_pageend>","</s_pageend>",5);
		$S_Order=getContent($text,"<s_order>","</s_order>",5);
		$S_AutoSave=getContent($text,"<s_autosave>","</s_autosave>",5);
		$S_SavePic=getContent($text,"<s_savepic>","</s_savepic>",5);
		$S_Safe=getContent($text,"<s_safe>","</s_safe>",5);
		$S_ListGo=getContent($text,"<s_listgo>","</s_listgo>",5);
		$S_ListEnd=getContent($text,"<s_listend>","</s_listend>",5);
		$S_LinkGo=getContent($text,"<s_linkgo>","</s_linkgo>",5);
		$S_LinkEnd=getContent($text,"<s_linkend>","</s_linkend>",5);
		$S_VideoNameGo=getContent($text,"<s_videonamego>","</s_videonamego>",5);
		$S_VideoNameEnd=getContent($text,"<s_videonameend>","</s_videonameend>",5); 
		$S_RemarkGo=getContent($text,"<s_remarkgo>","</s_remarkgo>",5); 
		$S_RemarkEnd=getContent($text,"<s_remarkend>","</s_remarkend>",5); 
		$S_DirectGo=getContent($text,"<s_directgo>","</s_directgo>",5); 
		$S_DirectEnd=getContent($text,"<s_directend>","</s_directend>",5); 
		$S_YearGo=getContent($text,"<s_yeargo>","</s_yeargo>",5); 
		$S_YearEnd=getContent($text,"<s_yearend>","</s_yearend>",5); 
		$S_AuthorGo=getContent($text,"<s_authorgo>","</s_authorgo>",5); 
		$S_AuthorEnd=getContent($text,"<s_authorend>","</s_authorend>",5); 
		$S_AreaMode=getContent($text,"<s_areamode>","</s_areamode>",5); 
		$S_AreaName=getContent($text,"<s_areaname>","</s_areaname>",5); 
		$S_AreaGo=getContent($text,"<s_areago>","</s_areago>",5); 
		$S_AreaEnd=getContent($text,"<s_areaend>","</s_areaend>",5); 
		$S_PicGo=getContent($text,"<s_picgo>","</s_picgo>",5); 
		$S_PicEnd=getContent($text,"<s_picend>","</s_picend>",5); 
		$S_LanguageMode=getContent($text,"<s_languagemode>","</s_languagemode>",5); 
		$S_LanguageName=getContent($text,"<s_languagename>","</s_languagename>",5); 
		$S_LanguageGo=getContent($text,"<s_languagego>","</s_languagego>",5); 
		$S_LanguageEnd=getContent($text,"<s_languageend>","</s_languageend>",5); 
		$S_ClassMode=getContent($text,"<s_classmode>","</s_classmode>",5);
		$S_ClassID=getContent($text,"<s_classid>","</s_classid>",5);
		$S_ClassGo=getContent($text,"<s_classgo>","</s_classgo>",5);
		$S_ClassEnd=getContent($text,"<s_classend>","</s_classend>",5);
		$S_ContentGo=getContent($text,"<s_contentgo>","</s_contentgo>",5);
		$S_ContentEnd=getContent($text,"<s_contentend>","</s_contentend>",5);
		$S_PlayUrlGo=getContent($text,"<s_playurlgo>","</s_playurlgo>",5);
		$S_PlayUrlEnd=getContent($text,"<s_playurlend>","</s_playurlend>",5);
		$S_AddGo=getContent($text,"<s_addgo>","</s_addgo>",5);
		$S_AddEnd=getContent($text,"<s_addend>","</s_addend>",5);
		$S_AddMode=getContent($text,"<s_addmode>","</s_addmode>",5);
		$S_AddOldStr=getContent($text,"<s_addoldstr>","</s_addoldstr>",5);
		$S_AddNewStr=getContent($text,"<s_addnewstr>","</s_addnewstr>",5);
		$S_AddTime=getContent($text,"<s_addtime>","</s_addtime>",5);
		$S_Replace=getContent($text,"<s_replace>","</s_replace>",5);
		$S_PlayUrlMode=getContent($text,"<s_playurlmode>","</s_playurlmode>",5);
		$S_AddPath=getContent($text,"<s_addpath>","</s_addpath>",5);
		$S_AddTime=date("Y-m-d H:i:s");
		if(!IsNum($S_PageGo)) $S_PageGo=1;
		if(!IsNum($S_PageEnd)) $S_PageEnd=1;
		if(!IsNum($S_AutoSave)) $S_AutoSave=0;
		if(!IsNum($S_SavePic)) $S_SavePic=0;	
 		 $sql="insert s_custom (S_Name,S_Url,S_Code,S_Source,S_Page,S_UrlStr,S_PageGo,S_PageEnd,S_Order,S_AutoSave,S_SavePic,S_Safe,S_ListGO,S_ListEnd,S_LinkGo,S_LinkEnd,S_VideoNameGo,S_VideoNameEnd,S_RemarkGo,S_RemarkEnd,S_DirectGo,S_DirectEnd,S_YearGO,S_YearEnd,S_AuthorGo,S_AuthorEnd,S_AreaMode,S_AreaName,S_AreaGo,S_AreaEnd,S_PicGo,S_PicEnd,S_LanguageMode,S_LanguageName,S_LanguageGo,S_LanguageEnd,S_ClassMode,S_ClassID,S_ClassGo,S_ClassEnd,S_ContentGo,S_ContentEnd,S_PlayUrlGo,S_PlayUrlEnd,S_AddGo,S_AddEnd,S_AddMode,S_AddOldStr,S_AddNewStr,S_AddTime,S_Replace,S_PlayUrlMode,S_AddPath) values ('$S_Name','$S_Url','$S_Code','$S_Source','$S_Page','$S_UrlStr','$S_PageGo','$S_PageEnd','$S_Order','$S_AutoSave','$S_SavePic','$S_Safe','$S_ListGo','$S_ListEnd','$S_LinkGo','$S_LinkEnd','$S_VideoNameGo','$S_VideoNameEnd' ,'$S_RemarkGo','$S_RemarkEnd','$S_DirectGo','$S_DirectEnd','$S_YearGo','$S_YearEnd','$S_AuthorGo','$S_AuthorEnd','$S_AreaMode','$S_AreaName','$S_AreaGo','$S_AreaEnd','$S_PicGo','$S_PicEnd','$S_LanguageMode','$S_LanguageName','$S_LanguageGo','$S_LanguageEnd','$S_ClassMode','$S_ClassID','$S_ClassGo','$S_ClassEnd','$S_ContentGo','$S_ContentEnd','$S_PlayUrlGo','$S_PlayUrlEnd','$S_AddGo','$S_AddEnd','$S_AddMode','$S_AddOldStr','$S_AddNewStr','$S_AddTime','$S_Replace','$S_PlayUrlMode','$S_AddPath')";	
		 //die($sql);
		   if($db->query($sql)){
	 		 echo("规则数据导入成功");
	 		 }
 			else{
			 echo("规则数据导入失败");
	 			}	
		}
	}
?>
<!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=gb2312" />
<link  href="../../images/style.css" rel="stylesheet" type="text/css" />
<title>舞曲自定义采集规则导出</title>
<link type="text/css" href="../../images/alerts.css" rel="stylesheet" media="screen">
<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script>
<script language="javascript" src="../../js/jquery.js"></script>
<script language="javascript" src="../../js/alerts.js"></script>
</head>
<body>
<?php
SystemPer(5);
function imp(){
	global $db;
	echo "<div class=\"r_main\">
	<div class=\"r_content\">
		<div class=\"r_content_1\">
			<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >
					<tr>
					  <td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_title\" >&nbsp;采集规则导入</td>
				  </tr>
				  	<tr>
						<td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_border\" >
							&nbsp;导入方式:<input type=radio class=radio name=mode checked onclick=\"javascript:document.getElementById('mode1').style.display='';document.getElementById('mode2').style.display='none';\">方式①<input type=radio class=radio name=mode onclick=\"javascript:document.getElementById('mode2').style.display='';document.getElementById('mode1').style.display='none';\">方式②
						</td>
					</tr>
					<tr id=mode1>
						<td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_border\"  >
						<form enctype=\"multipart/form-data\" action=\"?action=upload&mode=1\" name=\"uploadform\" method=\"post\">&nbsp;
						<input type=\"file\" name= \"file1\" >
  						<input name=\"action\" type=\"hidden\" value=\"upload\" />
						<input type=\"submit\" value=\"上传规则\">
						</form>
						</td>
					</tr>
					<tr id=mode2 style=\"display:none;\">
						<form name=from2 action=\"?action=upload&mode=2\" method=post>
						<td>
						<textarea name=content rows=20 cols=120 style=\"font-family: Arial, Helvetica, sans-serif;\"></textarea>
						<br/>
						<input type=submit value=\"导入采集规则\" class=rb1>
						</td>
						</form>
					</tr>
			</table>	
        </div>
    </div>
</div>";	
	}
	
function main($sid){
	global $db;
	$sql="select * from s_custom where S_ID=$sid";
	$row=$db->getRow($sql);
	if($row){
		$rule="<s_name>".$row["S_Name"]."</s_name>\r\n";
		$rule.="<s_url>".$row["S_Url"]."</s_url>\r\n";
		$rule.="<s_code>".$row["S_Code"]."</s_code>\r\n";
		$rule.="<s_source>".$row["S_Source"]."</s_source>\r\n";
		$rule.="<s_page>".$row["S_Page"]."</s_page>\r\n";		
		$rule.="<s_urlstr>".$row["S_UrlStr"]."</s_urlstr>\r\n";
		$rule.="<s_pagego>".$row["S_PageGo"]."</s_pagego>\r\n";
		$rule.="<s_pageend>".$row["S_PageEnd"]."</s_pageend>\r\n";
		$rule.="<s_order>".$row["S_Order"]."</s_order>\r\n";
		$rule.="<s_autosave>".$row["S_AutoSave"]."</s_autosave>\r\n";
		$rule.="<s_safe>".$row["S_Safe"]."</s_safe>\r\n";		
		$rule.="<s_savepic>".$row["S_SavePic"]."</s_savepic>\r\n";
		$rule.="<s_listgo>".$row["S_ListGo"]."</s_listgo>\r\n";
		$rule.="<s_listend>".$row["S_ListEnd"]."</s_listend>\r\n";
		$rule.="<s_linkgo>".$row["S_LinkGo"]."</s_linkgo>\r\n";
		$rule.="<s_linkend>".$row["S_LinkEnd"]."</s_linkend>\r\n";
		$rule.="<s_videonamego>".$row["S_VideoNameGo"]."</s_videonamego>\r\n";	
		$rule.="<s_videonameend>".$row["S_VideoNameEnd"]."</s_videonameend>\r\n";
		$rule.="<s_remarkgo>".$row["S_RemarkGo"]."</s_remarkgo>\r\n";	
		$rule.="<s_remarkend>".$row["S_RemarkEnd"]."</s_remarkend>\r\n";
		$rule.="<s_classmode>".$row["S_ClassMode"]."</s_classmode>\r\n";
		$rule.="<s_classid>".$row["S_ClassID"]."</s_classid>\r\n";					
		$rule.="<s_classgo>".$row["S_ClassGo"]."</s_classgo>\r\n";
		$rule.="<s_classend>".$row["S_ClassEnd"]."</s_classend>\r\n";	
		$rule.="<s_directgo>".$row["S_DirectGo"]."</s_directgo>\r\n";
		$rule.="<s_directend>".$row["S_DirectEnd"]."</s_directend>\r\n";
		$rule.="<s_areamode>".$row["S_AreaMode"]."</s_areamode>\r\n";
		$rule.="<s_areaname>".$row["S_AreaName"]."</s_areaname>\r\n";
		$rule.="<s_areago>".$row["S_AreaGo"]."</s_areago>\r\n";
		$rule.="<s_areaend>".$row["S_AreaEnd"]."</s_areaend>\r\n";	
		$rule.="<s_authorgo>".$row["S_AuthorGo"]."</s_authorgo>\r\n";
		$rule.="<s_authorend>".$row["S_AuthorEnd"]."</s_authorend>\r\n";	
		$rule.="<s_languagemode>".$row["S_LanguageMode"]."</s_languagemode>\r\n";
		$rule.="<s_languagename>".$row["S_LanguageName"]."</s_languagename>\r\n";
		$rule.="<s_languagego>".$row["S_LanguageGo"]."</s_languagego>\r\n";
		$rule.="<s_languageend>".$row["S_LanguageEnd"]."</s_languageend>\r\n";	
		$rule.="<s_yeargo>".$row["S_YearGo"]."</s_yeargo>\r\n";
		$rule.="<s_yearend>".$row["S_YearEnd"]."</s_yearend>\r\n";
		$rule.="<s_picgo>".$row["S_PicGo"]."</s_picgo>\r\n";
		$rule.="<s_picend>".$row["S_PicEnd"]."</s_picend>\r\n";
		$rule.="<s_contentgo>".$row["S_ContentGo"]."</s_contentgo>\r\n";
		$rule.="<s_contentend>".$row["S_ContentEnd"]."</s_contentend>\r\n";
		$rule.="<s_playurlmode>".$row["S_PlayUrlMode"]."</s_playurlmode>\r\n";
		$rule.="<s_playurlgo>".$row["S_PlayUrlGo"]."</s_playurlgo>\r\n";
		$rule.="<s_playurlend>".$row["S_PlayUrlEnd"]."</s_playurlend>\r\n";
		$rule.="<s_addmode>".$row["S_AddMode"]."</s_addmode>\r\n";
		$rule.="<s_addgo>".$row["S_AddGo"]."</s_addgo>\r\n";
		$rule.="<s_addend>".$row["S_AddEnd"]."</s_addend>\r\n";
		$rule.="<s_addoldstr>".$row["S_AddOldStr"]."</s_addoldstr>\r\n";
		$rule.="<s_addnewstr>".$row["S_AddNewStr"]."</s_addnewstr>\r\n";
		$rule.="<s_replace>".$row["S_Replace"]."</s_replace>\r\n";				
		}

	echo "<div class=\"r_main\">
	<div class=\"r_content\">
		<div class=\"r_content_1\">
			<form name=\"form1\" action=\"?action=save\" method=\"post\">
			<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"  class=\"tb_style\" >
					<tr>
					  <td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_title\">&nbsp;".$row["S_Name"]."采集规则<input type=hidden value=\"".$row["S_Name"]."\" name=sname></td>
				  </tr>
				  	<tr>
						<td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_border\">
					<textarea name=content rows=20 cols=120 style=\"font-family: Arial, Helvetica, sans-serif;\">$rule</textarea>
						</td>
					</tr>
					<tr>
						<td height=\"30\"  bgcolor=\"#FFFFFF\" class=\"td_border\"><input type=submit class=rb1 value=\"规则另存为\"></td>
					</tr>
			</table>	
			</form>
        </div>
    </div>
</div>";
	}

  

?> 
       
</body>
</html>
