<?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";
require_once('json.php');
include "../../admin_version.php";
include "../../admin_loginstate.php";
include "fun.php";
$jsoncls = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
@set_time_limit(0);
session_register("S_Name");
session_register("S_Url");
session_register("S_Day");
session_register("S_Source");
session_register("S_Code");
session_register("S_Class");
session_register("S_Page");
session_register("S_UrlStr");
session_register("S_PageGo");
session_register("S_PageEnd");
session_register("S_Order");
session_register("S_AutoSave");
session_register("S_SavePic");
session_register("S_Safe");
session_register("S_ListGo");
session_register("S_ListEnd");
session_register("S_LinkGo");
session_register("S_LinkEnd");					
session_register("S_VideoNameGo");	
session_register("S_VideoNameEnd");	
session_register("S_RemarkGo");	
session_register("S_RemarkEnd");
session_register("S_ClassMode");
session_register("S_ClassID");
session_register("S_ClassGo");
session_register("S_ClassEnd");
session_register("S_DirectGo");
session_register("S_DirectEnd");
session_register("S_AreaMode");
session_register("S_AreaName");
session_register("S_AreaGo");
session_register("S_AreaEnd");
session_register("S_AuthorGo");
session_register("S_AuthorEnd");
session_register("S_LanguageMode");
session_register("S_LanguageName");
session_register("S_LanguageGo");
session_register("S_LanguageEnd");
session_register("S_YearGo");
session_register("S_YearEnd");
session_register("S_PicMode");
session_register("S_PicGo");
session_register("S_PicEnd");			
session_register("S_ContentGo");
session_register("S_ContentEnd");
session_register("S_PlayUrlMode");
session_register("S_PlayUrlGo");
session_register("S_PlayUrlEnd");
session_register("S_AddMode");
session_register("S_AddGo");
session_register("S_AddEnd");
session_register("S_AddOldStr");
session_register("S_AddNewStr");
session_register("S_Replace");
session_register("S_AddPath");
?>
<!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" />
<link type="text/css" href="../../images/alerts.css" rel="stylesheet" media="screen">
<title>自定义采集</title>
<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script>
<script src="../../js/jquery.js"></script>
<script language="javascript" src="../../js/alerts.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#step1").click(function(){
		 var listgo = $("#S_ListGo").attr("value");
		 var listend = $("#S_ListGo").attr("value");
		 var linkgo = $("#s_linkgo").attr("value");
		 var linkend = $("#s_linkgo").attr("value");				   
		if($("#S_Name").val()==""){
			jAlert("请输入采集规则名称!","操作提示");
			return false;
			}
		else if($("#S_Url").val()==""){
			jAlert("请输入采集站点网址!","操作提示");
			return false;				
			}
		else if(listgo==''){
			jAlert("出错了，列表开始代码不能为空!","错误提示");
			return false;
		 }else if (listend==''){
			jAlert("出错了，列表结束代码不能为空!","错误提示");
			return false;
		 }else if(linkgo==''){
			jAlert("出错了，链接开始代码不能为空!","错误提示");
			return false;
		 }else if(linkend==''){
			jAlert("出错了，链接开始代码不能为空!","错误提示");
			return false;
		 }
		 else{
			document.form1.submit();
			 }
		
		})
})

function SelectTemplets(fname){
   if(document.all){
     var posLeft = window.event.clientY-100;
     var posTop = window.event.clientX-400;
   }
   else{
     var posLeft = 100;
     var posTop = 100;
   }
   window.open("../../admin_templets.php?f="+fname, "popmoldWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}
function showpage(id){
		$.get("ajax.php?id="+id+"&str=<?php echo urlencode($_SESSION['S_UrlStr']);?>&ps=<?php echo $_SESSION['S_PageGo'];?>&pe=<?php echo $_SESSION['S_PageEnd'];?>",function(R){
				$("#pagevalue").html(R);						 
				})
		
		}
function getcheck(){
	url=$("#S_UrlStr").val();
		$("#getinfo").html("测试中...");
		$.get("ajax.php?action=getcheck&url="+url,function(R){
			$("#getinfo").html(R);			
			   })
	}	
function trshow(trname,id){
	if(id==0){
		$("#"+trname+"0").css("display","");
		$("#"+trname+"1").css("display","none");
		$("#"+trname+"2").css("display","none");
	}else{
		$("#"+trname+"0").css("display","none");
		$("#"+trname+"1").css("display","");
		$("#"+trname+"2").css("display","");
	}
}	
function playurlshow(id){
	if (id==0){
		$("#s_playurlgo").html("地址列表开始代码：&nbsp;")
		$("#s_playurlend").html("地址列表结束代码：&nbsp;")
	}else if(id==1){
		$("#s_playurlgo").html("播放链接开始代码：&nbsp;")
		$("#s_playurlend").html("播放链接结束代码：&nbsp;")
	}
}
</script>
</head>

<body>
<?php
SystemPer(5);
class ui_collect{

	function step1($S_ID){
		global $db;
		$playadd=playadd(4);
?>
<div class="r_main">
	<div class="r_content">
		<div class="r_content_1">
<form action="?action=step2&amp;S_ID=<?php echo $S_ID;?>" name="form1" method="post">        
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  class="tb_style" >
					<tr>
					  	<td height="30" colspan="2" bgcolor="#FFFFFF" class="td_title">&nbsp;编辑采集规则&nbsp;<font color="red">１. 设置基本参数及列表连接设置</font>  2. 采集内容与歌曲地址设置  3. 完成并采集测试</td>
					</tr>
					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集规则名称：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><input name="S_Name" type="text"  size="50" value="<?php echo $_SESSION['S_Name']?>" id="S_Name"/>
						<font color="#FF0000">＊</font></td>
					</tr> 
					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集站点网址：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><input name="S_Url" type="text"   value="<?php echo $_SESSION['S_Url']?>" size="50" id="S_Url"/>
						<font color="#FF0000"> ＊</font></td>
					</tr> 
					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">目标网页编码：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><select name="S_Code" id="S_Code">
										<option value="GB2312" <?php if($_SESSION['S_Code']=='GB2312'){echo "selected";}?>>GB2312</option>
										<option value="UTF-8"  <?php if($_SESSION['S_Code']=='UTF-8'){echo "selected";}?>>UTF-8</option>
										<option value="BIG-5"  <?php if($_SESSION['S_Code']=='BIG-5'){echo "selected";}?>>BIG-5</option>
								   </select> <font color=#FF0000>＊</font>						</td>
					</tr>

                   <tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集播放类型：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border">
                        <select name="S_Source" id="S_Source">
                              <?php echo playselect($playadd,$_SESSION['S_Source']);?>
                         </select>&nbsp;
                           <select name="S_Server" id="S_Server">
                                <option value="">服务器组</option>
                                <?php echo getAddPath($_SESSION['S_AddPath']);?>
                            </select>
                            &nbsp;播放页模版：<input id="S_RemarkGo" name="S_RemarkGo" size="10" value="<?php echo $_SESSION['S_RemarkGo'];?>"> &nbsp;<input type="button" value="浏览..." style="width:60px"  onClick="SelectTemplets('form1.S_RemarkGo');" class="rb1" />
                         </td>                   
                   </tr> 
                   <tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集分页设置：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><input type="radio" name="S_Page"  checked class="radio" value="1" onclick="showpage(1);" <?php if($_SESSION['S_Page']=='1'){echo "checked";}?>/>
						  指定分类页
						  &nbsp;
						  <input type="radio" name="S_Page"  class="radio"  value="2" onclick="showpage(2);"  <?php if($_SESSION['S_Page']=='2'){echo "checked";}?>/>
						  自动分类页
						  &nbsp;
						  <input type="radio" name="S_Page"  class="radio"  value="3" onclick="showpage(3);"  <?php if($_SESSION['S_Page']=='3'){echo "checked";}?>/>
						  批量分类页&nbsp;
						  <input type="radio" name="S_Page"   class="radio"  value="4" onclick="showpage(4);"  <?php if($_SESSION['S_Page']=='4'){echo "checked";}?>/>						  
					    采集内容页</td>                   
                   </tr> 
					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border" id="pagetitle">采集页面网址：&nbsp;</td>
					  <td width="793"  align="left" bgcolor="#FFFFFF" class="td_border" id="pagevalue">
                      &nbsp;载入中......
					  <script type="text/javascript">
					  $.get("ajax.php?id=<?php echo $_SESSION['S_Page'];?>&str=<?php echo urlencode($_SESSION['S_UrlStr']);?>&ps=<?php echo $_SESSION['S_PageGo'];?>&pe=<?php echo $_SESSION['S_PageEnd'];?>",function(R){
						$("#pagevalue").html(R);						 
							})
                	</script>
                      </td>
					</tr>  
 					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集功能选项：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><input type="checkbox" name="S_Order" value="desc"  class="checkbox" <?php if($_SESSION['S_Order']=='desc'){echo "checked";}?>/>
						是否倒序采集&nbsp;&nbsp;&nbsp;
						<input type="checkbox" value="1" name="S_AutoSave" class="checkbox"  <?php if($_SESSION['S_AutoSave']=='1'){echo "checked";}?>/>
						  采集完毕自动入库&nbsp;&nbsp;
						  <input type="checkbox" name="S_SavePic" value="1"   class="checkbox" <?php if($_SESSION['S_SavePic']=='1'){echo "checked";}?>/>
						  入库完毕自动下载图片
				      </td>
					</tr> 
					<tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">采集过滤选项：&nbsp;</td>
					  <td width="793"  align="left" valign="middle" bgcolor="#FFFFFF" class="td_border"  style="padding-top:10px;">		                      <input type="checkbox" name="S_Safe[]" value="iframe"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"iframe")=='1'){echo "checked";}?>/>Iframe&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="object"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"object")=='1'){echo "checked";}?>/>Object&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="script"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"script")=='1'){echo "checked";}?>/>Script&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="div"     class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"div")=='1'){echo "checked";}?>/>Div&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="class"   class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"class")=='1'){echo "checked";}?>/>Class&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="table"   class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"table")=='1'){echo "checked";}?>/>Table<br /><br />
					  <input type="checkbox" name="S_Safe[]" value="span"    class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"span")=='1'){echo "checked";}?>/>Span&nbsp;&nbsp;&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="img"     class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"img")=='1'){echo "checked";}?>/>Img&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="font"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"font")=='1'){echo "checked";}?>/>Font&nbsp;&nbsp;&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="a"     class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"a")=='1'){echo "checked";}?>/>A &nbsp;&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="html"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"html")=='1'){echo "checked";}?>/>Html&nbsp;&nbsp;
                      <input type="checkbox" name="S_Safe[]" value="td"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"td")=='1'){echo "checked";}?>/>Td&nbsp;&nbsp; 
                      <input type="checkbox" name="S_Safe[]" value="tr"  class="checkbox" <?php if(safesplit($_SESSION['S_Safe'],"tr")=='1'){echo "checked";}?>/>Tr<br />
						  <br /></td>
					</tr>
                   <tr>
					  	<td width="146" height="35" align="right" bgcolor="#FFFFFF" class="td_border">图片采集设置：&nbsp;</td>
						<td width="793"  align="left" bgcolor="#FFFFFF" class="td_border"><input type="radio" name="S_PicMode"  checked class="radio" value="0" <?php if($_SESSION['S_PicMode']=='0'){echo "checked";}?>/>
						  栏目页采集
						  &nbsp;
						  <input type="radio" name="S_PicMode"  class="radio"  value="1" <?php if($_SESSION['S_PicMode']=='1'){echo "checked";}?>/>
						  播放页采集</td>                   
                   </tr> 
					<tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲列表开始代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_ListGo" id="S_ListGo" cols="70" rows="5"><?php echo $_SESSION['S_ListGo']?></textarea></td>
					</tr>
					<tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲列表结束代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_ListEnd" id="s_listend" cols="70" rows="5"><?php echo   $_SESSION['S_ListEnd'] ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲链接开始代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_LinkGo" id="s_linkgo" cols="70" rows="5"><?php echo   $_SESSION['S_LinkGo'] ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲链接开始代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_LinkEnd" id="s_linkend" cols="70" rows="5"><?php echo   $_SESSION['S_LinkEnd'] ?></textarea></td>
					</tr>    
<?php 
if($_SESSION['S_PicMode']==0) { 
?>
			<tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲图片开始代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_PicGo" id="S_PicGo" cols="70" rows="5"><?php echo $_SESSION['S_PicGo']?></textarea></td>
					</tr>
			<tr>
					  	<td width="155" height="30" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲图片结束代码：&nbsp;</td>
						<td width="728"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<textarea name="S_PicEnd" id="S_PicEnd" cols="70" rows="5"><?php echo $_SESSION['S_PicEnd']?></textarea></td>
					</tr> 
<?php
}
?>               
					<tr>
				  	  <td height="40" bgcolor="#FFFFFF" class="td_border">&nbsp;</td>
					  <td height="30" bgcolor="#FFFFFF" class="td_border"><input name="step1" type="button" class="rb1" id="step1"   value="继续下一步"/></td>
					</tr>                                                                                                                     
				</table>    
                </form>    
        </div>
    </div>
</div> 
<?php 
	}
function step2($S_ID){
	global $db;
		$clsstr='';
		$sql="select S_ID,S_Name from s_class where S_SystemID=1";
		$result=$db->query($sql);
		if($result){
			while($row=$db->fetch_array($result)){
				if($_SESSION['S_ClassID']==$row['S_ID']){
					$clsstr.="<option value=\"".$row['S_ID']."\" selected>".$row['S_Name']."</option>\r\n";
					}
				else{
					$clsstr.="<option value=\"".$row['S_ID']."\">".$row['S_Name']."</option>\r\n";
					}	
				}
			}	
			
?>
<div class="r_main">
	<div class="r_content">
		<div class="r_content_1">
        <form name="form2" action="?action=step3&amp;S_ID=<?php echo $S_ID;?>" method="post">
            	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  class="tb_style" >
					<tr>
					  	<td height="30" colspan="2" bgcolor="#FFFFFF" class="td_title">&nbsp;编辑采集规则&nbsp;１. 设置基本参数及列表连接设置  <font color="red">2. 采集内容与歌曲地址设置</font>  3. 完成并采集测试</td>
					</tr>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲名称开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_VideoNameGo" cols="70" rows="5"><?php echo $_SESSION['S_VideoNameGo']; ?></textarea></td>
					</tr>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲名称结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_VideoNameEnd" cols="70" rows="5"><?php echo $_SESSION['S_VideoNameEnd']; ?></textarea></td>
					</tr>
					
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲分类采集设置：&nbsp;</td>
					    <td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
				      <input type="radio" name="S_ClassMode" id="S_ClassMode" value="0"  class="radio" checked onClick="trshow('s_classid',0)"/>固定分类&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="S_ClassMode" id="S_ClassMode" value="1"  class="radio" <?php if($_SESSION['S_ClassMode']=='1'){echo "checked"; }?> onClick="trshow('s_classid',1)"/>					    自动转换</td>
					</tr>
                    <tr id="s_classid0" <?php if($_SESSION['S_ClassMode']!='0'){ echo "style=\"display:none;\"";} ?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">固定舞曲分类选择：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
                        	<select name="S_ClassID">
 							<?php echo $clsstr; ?>
                      </select></td>
					</tr>
					<tr id="s_classid1" <?php if($_SESSION['S_ClassMode']!=1){ echo "style=\"display:none;\"";} ?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲分类开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_ClassGo" cols="70" rows="5"><?php echo $_SESSION['S_ClassGo']; ?></textarea></td>
					</tr>
                    <tr id="s_classid2" <?php if($_SESSION['S_ClassMode']!=1){ echo "style=\"display:none;\"";} ?> >
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲分类结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_ClassEnd" cols="70" rows="5"><?php echo $_SESSION['S_ClassEnd']; ?></textarea></td>
					</tr>
					                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地区采集设置：&nbsp;</td>
					    <td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					      <input type="radio" name="S_AreaMode" id="S_AreaMode" value="0"  class="radio" checked onClick="trshow('s_areamode',0)"/>固定地区&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="S_AreaMode" id="S_AreaMode" value="1" class="radio" <?php if($_SESSION['S_AreaMode']=='1') { echo "checked";} ?> onClick="trshow('s_areamode',1)" /> 
				      采集地区					    </td>
					</tr>
					<tr id="s_areamode0" <?php if($_SESSION['S_AreaMode']!='0'){ echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">固定舞曲地区选择：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
                        	<select name="S_AreaName">
                            <?php
                            $sqlarea="select S_AreaName from s_area";
							$arearesult=$db->query($sqlarea);
							if($arearesult){
								while($area=$db->fetch_array($arearesult)){
									if($_SESSION['S_AreaName']==$area['S_AreaName']){
										echo "<option value=\"".$area['S_AreaName']."\" selected>".$area['S_AreaName']."</option>\r\n";
										}
									else{
										echo "<option value=\"".$area['S_AreaName']."\">".$area['S_AreaName']."</option>\r\n";
										}	
									
									}
								}
							?>
                      </select></td>
					</tr>
                    <tr id="s_areamode1"<?php if($_SESSION['S_AreaMode']!='1'){echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地区开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AreaGo" cols="70" rows="5"><?php echo $_SESSION['S_AreaGo']; ?></textarea></td>
					</tr>
                    <tr id="s_areamode2" <?php if($_SESSION['S_AreaMode']!='1'){echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地区结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AreaEnd" cols="70" rows="5"><?php echo $_SESSION['S_AreaEnd']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲歌手开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AuthorGo" cols="70" rows="5"><?php echo $_SESSION['S_AuthorGo']; ?></textarea></td>
					</tr>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲歌手结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AuthorEnd" cols="70" rows="5"><?php echo $_SESSION['S_AuthorEnd']; ?></textarea></td>
					</tr>
					
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲语言要集设置：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
						  <input type="radio" name="S_LanguageMode" id="S_LanguageMode" value="0"  class="radio" checked onClick="trshow('s_language',0)"/>固定语言&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="S_LanguageMode" id="S_LanguageMode" value="1" class="radio" <?php if($_SESSION['S_LanguageMode']==1){echo "checked";} ?> onClick="trshow('s_language',1)"/>
					  采集语言</td>
					</tr>
					<tr id="s_language0" <?php if($_SESSION['S_LanguageMode']!='0'){ echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">固定舞曲语言选择：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
                        	<select name="S_LanguageName">
                           <?php
                            $sqllan="select S_Language from s_area";
							$lanresult=$db->query($sqllan);
							if($lanresult){
								while($lan=$db->fetch_array($lanresult)){
									if($_SESSION['S_LanguageName']==$lan['S_Language']){
										echo "<option value=\"".$lan['S_Language']."\" selected>".$lan['S_Language']."</option>\r\n";
										}
									else{
										echo "<option value=\"".$lan['S_Language']."\">".$lan['S_Language']."</option>\r\n";
										}	
									
									}
								}
							?>
                      </select></td>
					</tr>
                    
					<tr id="s_language1" <?php if($_SESSION['S_LanguageMode']!=1){ echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲语言开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_LanguageGo" cols="70" rows="5"><?php echo $_SESSION['S_LanguageGo']; ?></textarea></td>
					</tr>
                    <tr id="s_language2" <?php if($_SESSION['S_LanguageMode']!=1) { echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲语言结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_LanguageEnd" cols="70" rows="5"><?php echo $_SESSION['S_LanguageEnd']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">发行年份开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_YearGo" cols="70" rows="5"><?php echo $_SESSION['S_YearGo']; ?></textarea></td>
					</tr>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">发行年份结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_YearEnd" cols="70" rows="5"><?php echo $_SESSION['S_YearEnd']; ?></textarea></td>
					</tr>
<?php 
if($_SESSION['S_PicMode']==1) { 
?>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲图片开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_PicGo" cols="70" rows="5"><?php echo $_SESSION['S_PicGo']; ?></textarea></td>
					</tr>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲图片结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_PicEnd" cols="70" rows="5"><?php echo $_SESSION['S_PicEnd']; ?></textarea></td>
					</tr>
<?php
}
?>
					<tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲介绍开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_ContentGo" cols="70" rows="5"><?php echo $_SESSION['S_ContentGo']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲介绍结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_ContentEnd" cols="70" rows="5"><?php echo $_SESSION['S_ContentEnd']; ?></textarea></td>
					</tr>

                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地址采集模式：&nbsp;</td>
				      <td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
				        <input type="radio" name="S_PlayUrlMode" id="S_PlayUrlMode" value="0"  class="radio" checked onClick="playurlshow(0)"/>					      
				        内容页采集舞曲地址&nbsp;&nbsp;&nbsp;&nbsp;
					      <input type="radio" name="S_PlayUrlMode" id="S_PlayUrlMode" value="1"  class="radio" <?php if($_SESSION['S_PlayUrlMode']=='1'){echo "checked";} ?> onClick="playurlshow(1)"/>  					    
					      播放页采集舞曲地址</td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border" id="s_playurlgo"><?php if($_SESSION['S_PlayUrlMode']=='0'){ echo "地址列表开始代码";}else{echo "播放链接开始代码";}?>：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_PlayUrlGo" cols="70" rows="5"><?php echo $_SESSION['S_PlayUrlGo']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border" id="s_playurlend"><?php if($_SESSION['S_PlayUrlMode']=='0'){ echo "地址列表结束代码";} else{echo "播放链接结束代码";}?>：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_PlayUrlEnd" cols="70" rows="5"><?php echo $_SESSION['S_PlayUrlEnd']; ?></textarea></td>
					</tr>
                    
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">特殊播放链接处理：&nbsp;</td>
					  <td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <input type="radio" name="S_AddMode" id="S_AddMode" value="0" class="radio" checked  onclick="trshow('s_add',0)"/>不作设置&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="S_AddMode" id="S_AddMode" value="1" class="radio" <?php if($_SESSION['S_AddMode']=='1'){echo "checked";}?> onClick="trshow('s_add',1)"/>替换地址<br /></td>
					</tr>
                    <tr><td  id="s_add0" colspan="2" height="0" class=""></td></tr>
                    <tr id="s_add1" <?php if($_SESSION['S_AddMode']!='1'){echo "style=\"display:none;\"" ;}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">要替换的地址内容：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;<font color="red">&nbsp;对于使用了Javascript:openwindow形式的连接请使用以下格式处理:<br />
&nbsp;&nbsp;脚本连接:内容[变量] 内容 如:javaScript:openwnd([变量])<br />
&nbsp;&nbsp;实际连接:内容[变量] 内容 如:play.asp?id=[变量]</font><br />  
				          &nbsp; <textarea name="S_AddOldStr" cols="70" rows="5"><?php echo $_SESSION['S_AddOldStr']; ?></textarea></td>
					</tr>
                    <tr id="s_add2" <?php if($_SESSION['S_AddMode']!='1'){ echo "style=\"display:none;\"";}?>>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">替换为的地址内容：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AddNewStr" cols="70" rows="5"><?php echo $_SESSION['S_AddNewStr']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地址开始代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AddGo" cols="70" rows="5"><?php echo $_SESSION['S_AddGo']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="30" align="right" bgcolor="#FFFFFF" class="td_border">舞曲地址结束代码：&nbsp;</td>
						<td width="617"  align="left" bgcolor="#FFFFFF" class="td_border">&nbsp;
					  <textarea name="S_AddEnd" cols="70" rows="5"><?php echo $_SESSION['S_AddEnd']; ?></textarea></td>
					</tr>
                    <tr>
					  	<td width="126" height="35" align="right" bgcolor="#FFFFFF" class="td_border">&nbsp;舞曲采集介绍替换：&nbsp;</td>
				      <td width="617"  align="left" bgcolor="#FFFFFF" class="td_border"> &nbsp;
					      <textarea name="S_Replace" id="S_Replace" cols="70" rows="5"><?php echo $_SESSION['S_Replace']; ?></textarea><br />
					  <span style="color:red">&nbsp; 格式：被替换的内容@@替换为的内容，每行为一个多个替换请以回车键换行，可使用&nbsp;&nbsp;[变量]&nbsp;&nbsp;标签&nbsp;<br>
					  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
					</tr>
					<tr>
					  	<td height="30" bgcolor="#FFFFFF" class="td_border" align="center">&nbsp;</td>
					    <td height="30" bgcolor="#FFFFFF" class="td_border" ><input name="botton4" type="button" class="rb1"  onclick="history.go(-1);" value="返回上一步"/>
					  	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="submit1" type="submit" class="rb1" value="保存采集规则"  /></td>
					</tr>
					<tr>
					  	<td height="30" bgcolor="#FFFFFF" class="td_border" colspan="2">&nbsp;</td>
					</tr>
			  </table>
              </form>
        </div>
    </div>
</div> 
<?php	
	}

}//end class
	$ui=new ui_collect;
	$action=CollectGet("action","get");
	switch($action){
		case 'step1':
			$S_ID=CollectGet("S_ID","get");
			$sql="select * from s_custom where S_ID=$S_ID";
			$row=$db->getrow($sql);
			if($row){
			$_SESSION['S_Name']=$row["S_Name"];
			$_SESSION['S_Url']=$row["S_Url"];
			$_SESSION['S_Source']=$row["S_Source"];
			$_SESSION['S_Code']=$row["S_Code"];
			$_SESSION['S_Page']=$row["S_Page"];
			$_SESSION['S_UrlStr']=$row["S_UrlStr"];
			$_SESSION['S_PageGo']=$row["S_PageGo"];
			$_SESSION['S_PageEnd']=$row["S_PageEnd"];
			$_SESSION['S_Order']=$row["S_Order"];
			$_SESSION['S_AutoSave']=$row["S_AutoSave"];
			$_SESSION['S_SavePic']=$row["S_SavePic"];
			$_SESSION['S_Safe']=$row["S_Safe"];
			$_SESSION['S_ListGo']=$row["S_ListGo"];
			$_SESSION['S_ListEnd']=$row["S_ListEnd"];
			$_SESSION['S_LinkGo']=$row["S_LinkGo"];
			$_SESSION['S_LinkEnd']=$row["S_LinkEnd"];					
			$_SESSION['S_VideoNameGo']=$row["S_VideoNameGo"];	
			$_SESSION['S_VideoNameEnd']=$row["S_VideoNameEnd"];	
			$_SESSION['S_RemarkGo']=$row["S_RemarkGo"];	
			$_SESSION['S_RemarkEnd']=$row["S_RemarkEnd"];
			$_SESSION['S_ClassMode']=$row["S_ClassMode"];
			$_SESSION['S_ClassID']=$row["S_ClassID"];
			$_SESSION['S_ClassGo']=$row["S_ClassGo"];
			$_SESSION['S_ClassEnd']=$row["S_ClassEnd"];
			$_SESSION['S_DirectGo']=$row["S_DirectGo"];
			$_SESSION['S_DirectEnd']=$row["S_DirectEnd"];
			$_SESSION['S_AreaMode']=$row["S_AreaMode"];
			$_SESSION['S_AreaName']=$row["S_AreaName"];
			$_SESSION['S_AreaGo']=$row["S_AreaGo"];
			$_SESSION['S_AreaEnd']=$row["S_AreaEnd"];
			$_SESSION['S_AuthorGo']=$row["S_AuthorGo"];
			$_SESSION['S_AuthorEnd']=$row["S_AuthorEnd"];
			$_SESSION['S_LanguageMode']=$row["S_LanguageMode"];
			$_SESSION['S_LanguageName']=$row["S_LanguageName"];
			$_SESSION['S_LanguageGo']=$row["S_LanguageGo"];
			$_SESSION['S_LanguageEnd']=$row["S_LanguageEnd"];
			$_SESSION['S_YearGo']=$row["S_YearGo"];
			$_SESSION['S_YearEnd']=$row["S_YearEnd"];
			$_SESSION['S_PicMode']=$row["S_PicMode"];
			$_SESSION['S_PicGo']=$row["S_PicGo"];
			$_SESSION['S_PicEnd']=$row["S_PicEnd"];			
			$_SESSION['S_ContentGo']=$row["S_ContentGo"];
			$_SESSION['S_ContentEnd']=$row["S_ContentEnd"];
			$_SESSION['S_PlayUrlMode']=$row["S_PlayUrlMode"];
			$_SESSION['S_PlayUrlGo']=$row["S_PlayUrlGo"];
			$_SESSION['S_PlayUrlEnd']=$row["S_PlayUrlEnd"];
			$_SESSION['S_AddMode']=$row["S_AddMode"];
			$_SESSION['S_AddGo']=$row["S_AddGo"];
			$_SESSION['S_AddEnd']=$row["S_AddEnd"];
			$_SESSION['S_AddOldStr']=$row["S_AddOldStr"];
			$_SESSION['S_AddNewStr']=$row["S_AddNewStr"];
			$_SESSION['S_Replace']=$row["S_Replace"];
			$_SESSION['S_AddPath']=$row["S_AddPath"];
				}	
			$ui->step1($S_ID);
			break;
		case 'main':
			$ui->main();
			break;
		case 'step2':
			$S_ID=CollectGet("S_ID","get");
			$_SESSION['S_Name']=CollectGet("S_Name","post");
			$_SESSION['S_Url']=CollectGet("S_Url","post");
			$_SESSION['S_Code']=CollectGet("S_Code","post");
			$_SESSION['S_Source']=CollectGet("S_Source","post");
			$_SESSION['S_Class']=CollectGet("S_Class","post");
			$_SESSION['S_Page']=CollectGet("S_Page","post");
			$_SESSION['S_UrlStr']=CollectGet("S_UrlStr","post");
			$_SESSION['S_PageGo']=CollectGet("S_PageGo","post");
			$_SESSION['S_PageEnd']=CollectGet("S_PageEnd","post");
			$_SESSION['S_Order']=CollectGet("S_Order","post");
			$_SESSION['S_AutoSave']=CollectGet("S_AutoSave","post");
			$_SESSION['S_SavePic']=CollectGet("S_SavePic","post");
			$_SESSION['S_Safe']=RequestBox("S_Safe");
			$_SESSION['S_ListGo']=CollectGet("S_ListGo","post");
			$_SESSION['S_ListEnd']=CollectGet("S_ListEnd","post");
			$_SESSION['S_LinkGo']=CollectGet("S_LinkGo","post");
			$_SESSION['S_LinkEnd']=CollectGet("S_LinkEnd","post");	
			$_SESSION['S_AddPath']=CollectGet("S_Server","post");	
			$_SESSION['S_RemarkGo']=CollectGet("S_RemarkGo","post");
			$_SESSION['S_PicMode']=CollectGet("S_PicMode","post");
			$_SESSION['S_PicGo']=CollectGet("S_PicGo","post");
			$_SESSION['S_PicEnd']=CollectGet("S_PicEnd","post");
			$ui->step2($S_ID);
			break;
		case 'step3':
			$_SESSION['S_VideoNameGo']=CollectGet("S_VideoNameGo","post");	
			$_SESSION['S_VideoNameEnd']=CollectGet("S_VideoNameEnd","post");	
			$_SESSION['S_ClassMode']=CollectGet("S_ClassMode","post");
			$_SESSION['S_ClassID']=CollectGet("S_ClassID","post");
			$_SESSION['S_ClassGo']=CollectGet("S_ClassGo","post");
			$_SESSION['S_ClassEnd']=CollectGet("S_ClassEnd","post");
			$_SESSION['S_DirectGo']=CollectGet("S_DirectGo","post");
			$_SESSION['S_DirectEnd']=CollectGet("S_DirectEnd","post");
			$_SESSION['S_AreaMode']=CollectGet("S_AreaMode","post");
			$_SESSION['S_AreaName']=CollectGet("S_AreaName","post");
			$_SESSION['S_AreaGo']=CollectGet("S_AreaGo","post");
			$_SESSION['S_AreaEnd']=CollectGet("S_AreaEnd","post");
			$_SESSION['S_AuthorGo']=CollectGet("S_AuthorGo","post");
			$_SESSION['S_AuthorEnd']=CollectGet("S_AuthorEnd","post");
			$_SESSION['S_LanguageMode']=CollectGet("S_LanguageMode","post");
			$_SESSION['S_LanguageName']=CollectGet("S_LanguageName","post");
			$_SESSION['S_LanguageGo']=CollectGet("S_LanguageGo","post");
			$_SESSION['S_LanguageEnd']=CollectGet("S_LanguageEnd","post");
			$_SESSION['S_YearGo']=CollectGet("S_YearGo","post");
			$_SESSION['S_YearEnd']=CollectGet("S_YearEnd","post");
if($_SESSION['S_PicMode']==1) { 
			$_SESSION['S_PicGo']=CollectGet("S_PicGo","post");
			$_SESSION['S_PicEnd']=CollectGet("S_PicEnd","post");
}
			$_SESSION['S_ContentGo']=CollectGet("S_ContentGo","post");
			$_SESSION['S_ContentEnd']=CollectGet("S_ContentEnd","post");
			$_SESSION['S_PlayUrlMode']=CollectGet("S_PlayUrlMode","post");
			$_SESSION['S_PlayUrlGo']=CollectGet("S_PlayUrlGo","post");
			$_SESSION['S_PlayUrlEnd']=CollectGet("S_PlayUrlEnd","post");
			$_SESSION['S_AddMode']=CollectGet("S_AddMode","post");
			$_SESSION['S_AddGo']=CollectGet("S_AddGo","post");
			$_SESSION['S_AddEnd']=CollectGet("S_AddEnd","post");
			$_SESSION['S_AddOldStr']=CollectGet("S_AddOldStr","post");
			$_SESSION['S_AddNewStr']=CollectGet("S_AddNewStr","post");
			$_SESSION['S_Replace']=CollectGet("S_Replace","post");
			saveRules();
			break;
		default:
			$ui->main();
			break;
		}

function safesplit($str,$value){
		$strArr=explode(',',$str);
		for($i=0;$i<count($strArr);$i++){
			if($strArr[$i]==$value){
				return "1";
				break;
				}
			}		
	}

function saveRules(){
 global $db;
  $S_ID=CollectGet("S_ID","get");
  $S_Name=$_SESSION['S_Name'];
  $S_Url=$_SESSION['S_Url'];
  $S_Code=$_SESSION['S_Code'];
  $S_Source=$_SESSION['S_Source'];
  $S_Page=$_SESSION['S_Page'];
  $S_UrlStr=$_SESSION['S_UrlStr'];
  if($S_Page=='3' or $S_Page=='4'){
	  $TempArr=explode(chr(13).chr(10),$S_UrlStr);
	  $S_UrlStr=implode('#',$TempArr);	 
	  }
  $S_PageGo=$_SESSION['S_PageGo'];
  $S_PageEnd=$_SESSION['S_PageEnd'];
  $S_Order=$_SESSION['S_Order'];
  $S_AutoSave=$_SESSION['S_AutoSave'];
  $S_SavePic=$_SESSION['S_SavePic'];
  $S_Safe=$_SESSION['S_Safe'];
  $S_ListGo=$_SESSION['S_ListGo'];
  $S_ListEnd=$_SESSION['S_ListEnd'];
  $S_LinkGo=$_SESSION['S_LinkGo'];
  $S_LinkEnd=$_SESSION['S_LinkEnd'];
  $S_VideoNameGo=$_SESSION['S_VideoNameGo'];
  $S_VideoNameEnd=$_SESSION['S_VideoNameEnd']; 
  $S_RemarkGo=$_SESSION['S_RemarkGo'];
  $S_RemarkEnd=$_SESSION['S_RemarkEnd'];
  $S_DirectGo=$_SESSION['S_DirectGo'];
  $S_DirectEnd=$_SESSION['S_DirectEnd'];
  $S_YearGo=$_SESSION['S_YearGo'];
  $S_YearEnd=$_SESSION['S_YearEnd'];
  $S_AuthorGo=$_SESSION['S_AuthorGo'];
  $S_AuthorEnd=$_SESSION['S_AuthorEnd'];
  $S_AreaMode=$_SESSION['S_AreaMode'];
  $S_AreaName=$_SESSION['S_AreaName'];
  $S_AreaGo=$_SESSION['S_AreaGo'];
  $S_AreaEnd=$_SESSION['S_AreaEnd'];
  $S_PicMode=$_SESSION['S_PicMode'];
  $S_PicGo=$_SESSION['S_PicGo'];
  $S_PicEnd=$_SESSION['S_PicEnd'];
  $S_LanguageMode=$_SESSION['S_LanguageMode'];
  $S_LanguageName=$_SESSION['S_LanguageName'];
  $S_LanguageGo=$_SESSION['S_LanguageGo'];
  $S_LanguageEnd=$_SESSION['S_LanguageEnd'];
  $S_ClassMode=$_SESSION['S_ClassMode'];
  $S_ClassID=$_SESSION['S_ClassID'];
  $S_ClassGo=$_SESSION['S_ClassGo'];
  $S_ClassEnd=$_SESSION['S_ClassEnd'];
  $S_ContentGo=$_SESSION['S_ContentGo'];
  $S_ContentEnd=$_SESSION['S_ContentEnd'];
  $S_PlayUrlGo=$_SESSION['S_PlayUrlGo'];
  $S_PlayUrlEnd=$_SESSION['S_PlayUrlEnd'];
  $S_AddGo=$_SESSION['S_AddGo'];
  $S_AddEnd=$_SESSION['S_AddEnd'];
  $S_AddMode=$_SESSION['S_AddMode'];
  $S_AddOldStr=$_SESSION['S_AddOldStr'];
  $S_AddNewStr=$_SESSION['S_AddNewStr'];
  $S_Replace=$_SESSION['S_Replace'];
  $S_PlayUrlMode=$_SESSION['S_PlayUrlMode'];
  $S_AddPath=$_SESSION['S_AddPath'];
  $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="update  s_custom set S_Name='$S_Name',S_Url='$S_Url',S_Code='$S_Code',S_Source='$S_Source',S_Page=$S_Page,S_UrlStr='$S_UrlStr',S_PageGo=$S_PageGo,S_PageEnd=$S_PageEnd,S_Order='$S_Order',S_AutoSave=$S_AutoSave,S_SavePic=$S_SavePic,S_Safe='$S_Safe',S_ListGo='$S_ListGo',S_ListEnd='$S_ListEnd',S_LinkGo='$S_LinkGo',S_LinkEnd ='$S_LinkEnd',S_VideoNameGo='$S_VideoNameGo',S_VideoNameEnd ='$S_VideoNameEnd' ,S_RemarkGo='$S_RemarkGo',S_RemarkEnd='$S_RemarkEnd',S_DirectGo='$S_DirectGo',S_DirectEnd='$S_DirectEnd',S_YearGo='$S_YearGo',S_YearEnd='$S_YearEnd',S_AuthorGo='$S_AuthorGo',S_AuthorEnd='$S_AuthorEnd',S_AreaMode=$S_AreaMode,S_AreaName='$S_AreaName',S_AreaGo='$S_AreaGo',S_AreaEnd='$S_AreaEnd',S_PicMode=$S_PicMode,S_PicGo='$S_PicGo',S_PicEnd='$S_PicEnd',S_LanguageMode=$S_LanguageMode,S_LanguageName='$S_LanguageName',S_LanguageGo='$S_LanguageGo',S_LanguageEnd='$S_LanguageEnd',S_ClassMode=$S_ClassMode,S_ClassID=$S_ClassID,S_ClassGo='$S_ClassGo',S_ClassEnd='$S_ClassEnd',S_ContentGo ='$S_ContentGo',S_ContentEnd='$S_ContentEnd',S_PlayUrlGo='$S_PlayUrlGo',S_PlayUrlEnd='$S_PlayUrlEnd',S_AddGo='$S_AddGo',S_AddEnd='$S_AddEnd',S_AddMode=$S_AddMode,S_AddOldStr='$S_AddOldStr',S_AddNewStr='$S_AddNewStr',S_AddTime='$S_AddTime',S_Replace='$S_Replace',S_PlayUrlMode=$S_PlayUrlMode,S_AddPath='$S_AddPath',S_AddTime='$S_AddTime' where S_ID=$S_ID";
  //die($sql);
  if($db->query($sql)){
	  die("规则编辑成功!&nbsp;<a href=\"admin_collecting.php?S_ID=$S_ID\"><font color=red>点击进入采集<font</a>");
	  }
 else{
	 die("未知错误规则编辑失败!");
	 }	  
	}
	
function getAddPath($path){
	global $db;
	$serverstr="";
	$sqlserver="select S_ID,S_Name from `s_pathip`";
	$resultserver=$db->query($sqlserver);
	  if($resultserver){
		  while($rowserver=$db->fetch_array($resultserver)){
			  if($path==$rowserver['S_ID']){
			  $serverstr.="<option value='".$rowserver['S_ID']."' selected='selected'>".$rowserver['S_Name']."</option>";
			  }
			  else{
			  $serverstr.="<option value='".$rowserver['S_ID']."'>".$rowserver['S_Name']."</option>";	
				  }	
			  }
		  }
	return $serverstr;	  
	}	
?> 
<?php require_once("../../admin_bottom.php");?>      
</body>
</html>