<?php
require_once('session.php');
require_once('../fun/funsql.php'); 
require_once('../fun/funlogic.php');
require_once('../fun/funclass.php');
set_time_limit(0);
$classstr = new classstr($dbz);
if (isset($_GET["rel"])){$rel=$_GET["rel"];}else{$rel="";}
$times=date("Y-m-d H:i:s");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>采集插件</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../fun/adminjs.js"></script>
<body>
<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'>采集插件</div></div>
<?php if($rel==''){?>
<?php 
$sql=query("select id from ".$dbz."getinfo limit 0,1");
if(!$sql){
?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>第一次使用采集插件,请先点击 <a href="plug_getinfo.php?rel=sql">安装</a></td>
</tr>
</table>
<?php 
}
else{
?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr align="center" height="24">
  <td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;[<a href="plug_getinfo.php?rel=add">添加规则</a>] .</b></td>
  </tr>
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">

<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left">ID</td>
<td bgcolor="#FFFFFF" align="left">名称</td>
<td bgcolor="#FFFFFF" align="left">采集地址</td>
<td bgcolor="#FFFFFF" align="left">时间</td>
<td bgcolor="#FFFFFF" align="left">管理</td>
</tr>
<?php 
$sql=query("select * from ".$dbz."getinfo order by id desc");
while($row=fetch($sql)){
?>
<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left"><?php echo $row["id"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row["names"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row["urls"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row["times"]; ?></td>
<td bgcolor="#FFFFFF" align="left"><a href="plug_getinfo.php?rel=ce&id=<?php echo $row["id"]; ?>">测试</a> <a href="plug_getinfo.php?rel=get&id=<?php echo $row["id"]; ?>">采集</a> <a href="plug_getinfo.php?rel=info&id=<?php echo $row["id"]; ?>">修改</a> <a href="plug_getinfo.php?rel=del&id=<?php echo $row["id"]; ?>">删除</a></td>
</tr>
<?php }?>
<tr align="center" height="24">
  <td height="30" align="left" bgcolor="#FFFFFF" colspan="9"> </td>
  </tr>
</table>
</td>
</tr>
</table>
<?php }}?>

<?php  if($rel=='dao'){?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
<td height="30" align="left" bgcolor="#EDF9D5"><b>&nbsp;[<a href="plug_getinfo.php">返回列表</a>]</b> &nbsp;&nbsp;</td>
</tr>

<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF">导出规则</td>
</tr>
<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF"><textarea cols="100" rows="20" ></textarea></td>
</tr>
</table>
</td>
</tr>
</table>
<?php }?>

<?php if($rel=='get'){
$id=funstr($_GET["id"]);
$sql=query("select * from ".$dbz."getinfo where id=$id");
if($row=fetch($sql)){
$code=@file_get_contents($row["urls"]);
  if($row["bians"]=='gbk'){$code=iconv("gbk","utf-8",$code);}
  $intervalsarr=explode("{[getinfo]}",funstr_1($row["urlintervals"]));
  $intervals=midstr($code,$intervalsarr[0],$intervalsarr[1]);
  //echo $intervals;
  $urlarr=explode("{[getinfo]}",funstr_1($row["rules"]));
  
  $urlarr1=explode($urlarr[0],$intervals);
  
  $urlstr='';
  $urlarri=1;
  while($urlarri<count($urlarr1)){
    $urlarr2=explode($urlarr[1],$urlarr1[$urlarri]);
	$urlarr2i=explode($row["urlincludes"],$urlarr2[0]);
	if(count($urlarr2i)<>1){$urlstr.=$row["urlprefixs"].$urlarr2[0].",";}
    $urlarri+=1;
  }
  
  //吧地址写入文本 按照id
  createdir("../cache/getinfo");
  createfile("../cache/getinfo/$id.txt",$urlstr);
  echo tanshow("","plug_getinfo.php?rel=geturl&id=".$id);

}}?>
<?php 
if($rel=='geturl'){
  $id=funstr($_GET["id"]);
  $urls=openfile("../cache/getinfo/".$id.".txt");
  $urlarr=explode(",",$urls);
  
?> 
  <form id="form3" name="form3" method="post" action="plug_getinfo.php?rel=geturl_all">
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<?php
  
  $urlarri=0;
  while($urlarri<(count($urlarr)-1)){
    //echo $urlarr[$urlarri]."<br />";
?>
	<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left"><input type="checkbox" id="checkbox<?php echo ($urlarri+1); ?>" name="checkbox<?php echo ($urlarri+1); ?>" value="<?php echo ($urlarri); ?>" /><?php echo ($urlarri+1); ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $urlarr[$urlarri]; ?></td>
</tr>
<?php 
	
    $urlarri+=1;
  }
?>
<tr align="center" height="24">
  <td height="30" align="left" bgcolor="#FFFFFF" colspan="9"><a href="#" onclick="checkbox('checkbox',<?php echo $urlarri; ?>)">全选/取消</a> 
  <input type="hidden" name="ids" value="<?php echo $id; ?>" />
  <input type="hidden" name="i" value="<?php echo $urlarri; ?>" />
  <input type="submit" name="Submit3" value="批量采集" /></form></td>
  </tr>
</table>
</td>
</tr>
</table>
<?php }?>

<?php 
if($rel=='geturl_all'){
  $ids=funstr($_POST["ids"]);
  $i=funstr($_POST["i"]);
  $n=1;
  $urls=openfile("../cache/getinfo/".$ids.".txt");
  $urlarr=explode(",",$urls);
  $urlstr='';
  while($n<=$i){
    $ns='checkbox'.$n;
	$id=@funstr($_POST[$ns]);
	if($id<>''){
	  $urlstr.=$urlarr[$n-1].",";
	}
    $n=$n+1;
  }
  createfile("../cache/getinfo/".$ids."_".$ids.".txt",$urlstr);
  echo tanshow("","plug_getinfo.php?rel=getinfo&id=$ids&i=1");
}
?>

<?php 
if($rel=='getinfo'){
  $id=funstr($_GET["id"]);
  $i=funstr($_GET["i"]);
  $urls=openfile("../cache/getinfo/".$id."_".$id.".txt");
  $urlarr=explode(",",$urls);
  if($i<count($urlarr)){
    $url=$urlarr[$i-1];
	$sql=query("select * from ".$dbz."getinfo where id=$id");
	if($row=fetch($sql)){
	  $code=@file_get_contents($url);
	  if($row["bians"]=='gbk'){$code=iconv("gbk","utf-8",$code);}
	  
	  $tags1=explode(",",funstr_1($row["tags"]));
      $tags1i=0;
      while($tags1i<count($tags1)){
        $tags2=explode(":",funstr_1($tags1[$tags1i]));
	    if(count($tags2)>1){$code=str_replace($tags2[0],$tags2[1],$code);}
        $tags1i+=1;
      }
	  
	  $titlearr=explode("{[getinfo]}",funstr_1($row["titles"]));
      $title=midstr($code,$titlearr[0],$titlearr[1]);
      $mgarr=explode("{[getinfo]}",funstr_1($row["mgs"]));
      $mg=html_clears(midstr($code,$mgarr[0],$mgarr[1]));
	  
	  
	  
	  $keywords=$title;
	  $dis=utf_substr($mg,100);
	  //utf_substr($mg,190);
	  echo "正在采集<br />";
	  echo "采集地址:".$url."<br />";
	  echo "长时间不动,<a href=\"plug_getinfo.php?rel=getinfo&id=$id&i=$i\">点击刷新</a><br />";
	  echo "此条出错进入下一条,<a href=\"plug_getinfo.php?rel=getinfo&id=$id&i=".($i+1)."\">点击</a><br />";
	  
	  if($title<>'0'){
	   $sql=query("insert into ".$dbz."news(titles,keywords,dis,users,sources,cid,trees,vips,slides,headlines,imgs,mg,tops,times,audits)values('$title','$keywords','".$dis."','".$row["users"]."','".$row["source"]."','".$row["cid"]."','".$row["trees"]."','0','0','0','','$mg','0','$times','1')");
		
		if($sql){echo tanshow("","plug_getinfo.php?rel=getinfo&id=$id&i=".($i+1));}else{echo mysql_error();}
		
	  }
	  else{
	    echo tanshow("","plug_getinfo.php?rel=getinfo&id=$id&i=".($i+1));
	  }
	}
	else{
	  echo "采集规则不存在.";
	}
  }
  else{
    echo "完成此规则下的采集!";
  }
}
?>

<?php if($rel=='ce'){
$id=funstr($_GET["id"]);
$sql=query("select * from ".$dbz."getinfo where id=$id");
if($row=fetch($sql)){
$code=@file_get_contents($row["urlces"]);
  if($row["bians"]=='gbk'){$code=iconv("gbk","utf-8",$code);}
  
  $tags1=explode(",",funstr_1($row["tags"]));
  $tags1i=0;
  while($tags1i<count($tags1)){
    $tags2=explode(":",funstr_1($tags1[$tags1i]));
	if(count($tags2)>1){$code=str_replace($tags2[0],$tags2[1],$code);}
    $tags1i+=1;
  }
  
  
  $titlearr=explode("{[getinfo]}",funstr_1($row["titles"]));
  $title=midstr($code,$titlearr[0],$titlearr[1]);
  $mgarr=explode("{[getinfo]}",funstr_1($row["mgs"]));
  $mg=html_clears(midstr($code,$mgarr[0],$mgarr[1]));
  
?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
<td height="30" align="left" bgcolor="#EDF9D5"><b>&nbsp;[<a href="plug_getinfo.php">返回列表</a>]</b> &nbsp;&nbsp;</td>
</tr>

<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF">测试文章标题</td>
</tr>
<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF"><input type="text" style="width:60%;" value="<?php echo $title; ?>" /></td>
</tr>

<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF">测试文章内容</td>
</tr>
<tr align="center" bgcolor="#FFFFFF"> 
<td align="left" bgcolor="#FFFFFF"><textarea cols="100" rows="10" ><?php echo $mg; ?></textarea></td>
</tr>
</table>
</td>
</tr>
</table>
<?php }}?>


<?php if($rel=='add'){?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<form id="form1" name="form1" method="post" action="plug_getinfo.php?rel=add_info">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
<td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;采集规则添加</b> 以下规则都必须为页面的唯一值   &nbsp;&nbsp;</td>
</tr>
<tr align="center"> 
<td width="20%" height="25" bgcolor="#FFFFFF">变量说明</td>
<td bgcolor="#FFFFFF">变量值</td>
<td width="30%" bgcolor="#FFFFFF">介绍</td>
</tr>  
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 规则名称:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='names' value='' style='width:60%' maxlength="50"></td>
<td align="left" bgcolor="#FFFFFF">无实际意义,主要用于标识采集规则</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 导出分类:</td>
<td align="left" bgcolor="#FFFFFF">
<select name="cid">
<?php 
$classstr->classarr();
echo $classstr->classadd();
?>
</select>
</td>
<td align="left" bgcolor="#FFFFFF">选择采集到信息导出的分类</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集地址:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urls' value='' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">需要采集的页面地址,信息列表页地址</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集区间:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="urlintervals" rows="5" cols="50"></textarea></td>
<td align="left" bgcolor="#FFFFFF">区间为,需要采集信息列表页那一块的信息地址. 规则为:{[getinfo]}</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 地址规则:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="rules" rows="5" cols="50"></textarea></td>
<td align="left" bgcolor="#FFFFFF">需要采集信息地址规则. 规则为:{[getinfo]}</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集地址必须包含:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlincludes' value='' style='width:60%' maxlength="100"></td>
<td align="left" bgcolor="#FFFFFF">采集地址必须包含的字符</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 地址前缀:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlprefixs' value='' style='width:60%' maxlength="100"></td>
<td align="left" bgcolor="#FFFFFF">页面地址为省略时,需要添加前缀</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 测试地址:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlces' value='' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">测试地址,为信息内容页地址,主要用于测试规则</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 替换字符:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="tags" rows="5" cols="50"></textarea></td>
<td align="left" bgcolor="#FFFFFF">替换字符:替换成字符,替换字符:替换成字符  格式</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 标题规则:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='titles' value='' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">规则为:{[getinfo]}</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 内容规则:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="mgs" rows="5" cols="50"></textarea></td>
<td align="left" bgcolor="#FFFFFF">规则为:{[getinfo]}</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 目标网站编码:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='bians' value='' style='width:60%' maxlength="20"></td>
<td align="left" bgcolor="#FFFFFF">插件可以区分 gbk , utf-8</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 其他设置:</td>
<td align="left" bgcolor="#FFFFFF">
作者:<input type='text' name='users' value='' style='width:20%' maxlength="20"> 来源:<input type='text' name='source' value='' style='width:20%' maxlength="20"> 自动:<input type="checkbox" name="audits" value="1" /></td>
<td align="left" bgcolor="#FFFFFF">其他设置</td>
</tr>

</table>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
  <td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;请按照说明设置.</b></td>
  </tr>
<tr align="center" height="24">
  <td height="30" colspan="3" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="确定" /> 
    <input type="reset" name="Submit2" value="重置" /></td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
<?php }?>

<?php if($rel=='info'){
$id=funstr($_GET["id"]);
$sql=query("select * from ".$dbz."getinfo where id=$id");
if($row=fetch($sql)){
  if($row["audits"]==1){$audits='checked=\"checked\"';}else{$audits='';};
?>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<form id="form1" name="form1" method="post" action="plug_getinfo.php?rel=info_info">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
<td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;采集规则修改</b> 以下规则都必须为页面的唯一值   &nbsp;&nbsp;</td>
</tr>
<tr align="center"> 
<td width="20%" height="25" bgcolor="#FFFFFF">变量说明</td>
<td bgcolor="#FFFFFF">变量值</td>
<td width="30%" bgcolor="#FFFFFF">介绍</td>
</tr>  
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 规则名称:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='names' value='<?php echo $row["names"]; ?>' style='width:60%' maxlength="50"></td>
<td align="left" bgcolor="#FFFFFF">无实际意义,主要用于标识采集规则</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 导出分类:</td>
<td align="left" bgcolor="#FFFFFF">
<select name="cid">
<option value="<?php echo $row["cid"]; ?>,<?php echo $row["trees"]; ?>" style="background-color:#FFCCFF">
<?php 
$sqlcl=query("select * from ".$dbz."class where id=".$row["cid"]);
if($rowcl=fetch($sqlcl)){echo $rowcl["names"];}
?>
</option>
<?php 
$classstr->classarr();
echo $classstr->classadd();
?>
</select>
</td>
<td align="left" bgcolor="#FFFFFF">选择采集到信息导出的分类</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集地址:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urls' value='<?php echo $row["urls"]; ?>' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">需要采集的页面地址,信息列表页地址</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集区间:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="urlintervals" rows="5" cols="50"><?php echo funstr_1($row["urlintervals"]); ?></textarea></td>
<td align="left" bgcolor="#FFFFFF">区间为,需要采集信息列表页那一块的信息地址. 规则为:{[getinfo]}</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 地址规则:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="rules" rows="5" cols="50"><?php echo funstr_1($row["rules"]); ?></textarea></td>
<td align="left" bgcolor="#FFFFFF">需要采集信息地址规则. 规则为:{[getinfo]}</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 采集地址必须包含:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlincludes' value='<?php echo $row["urlincludes"]; ?>' style='width:60%' maxlength="100"></td>
<td align="left" bgcolor="#FFFFFF">采集地址必须包含的字符</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 地址前缀:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlprefixs' value='<?php echo $row["urlprefixs"]; ?>' style='width:60%' maxlength="100"></td>
<td align="left" bgcolor="#FFFFFF">页面地址为省略时,需要添加前缀</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 测试地址:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='urlces' value='<?php echo $row["urlces"]; ?>' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">测试地址,为信息内容页地址,主要用于测试规则</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 替换字符:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="tags" rows="5" cols="50"><?php echo funstr_1($row["tags"]); ?></textarea></td>
<td align="left" bgcolor="#FFFFFF">替换字符:替换成字符,替换字符:替换成字符  格式</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 标题规则:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='titles' value='<?php echo funstr_1($row["titles"]); ?>' style='width:60%' maxlength="200"></td>
<td align="left" bgcolor="#FFFFFF">规则为:{[getinfo]}</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 内容规则:</td>
<td align="left" bgcolor="#FFFFFF">
<textarea name="mgs" rows="5" cols="50"><?php echo funstr_1($row["mgs"]); ?></textarea></td>
<td align="left" bgcolor="#FFFFFF">规则为:{[getinfo]}</td>
</tr>

<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 目标网站编码:</td>
<td align="left" bgcolor="#FFFFFF">
<input type='text' name='bians' value='<?php echo $row["bians"]; ?>' style='width:60%' maxlength="20"></td>
<td align="left" bgcolor="#FFFFFF">插件可以区分 gbk , utf-8</td>
</tr>
<tr align="center" height="24" bgcolor="#FFFFFF"> 
<td height="30" align="left" bgcolor="#FFFFFF"> 其他设置:</td>
<td align="left" bgcolor="#FFFFFF">
作者:<input type='text' name='users' value='<?php echo $row["users"]; ?>' style='width:20%' maxlength="20"> 来源:<input type='text' name='source' value='<?php echo $row["source"]; ?>' style='width:20%' maxlength="20"> 自动:<input type="checkbox" name="audits" value="1" <?php echo $audits; ?> /></td>
<td align="left" bgcolor="#FFFFFF">其他设置</td>
</tr>

</table>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center" height="24">
  <td height="30" colspan="3" align="left" bgcolor="#EDF9D5"><b>&nbsp;请按照说明设置.</b></td>
  </tr>
<tr align="center" height="24">
  <td height="30" colspan="3" align="center" bgcolor="#FFFFFF">
  <input type="hidden" name="id" value="<?php echo $row["id"]; ?>" />
  <input type="submit" name="Submit" value="确定" /> 
    <input type="reset" name="Submit2" value="重置" /></td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
<?php }}?>

<?php if($rel=='del'){
  $id=funstr($_GET["id"]);
  $sql=query("delete from ".$dbz."getinfo where id='$id'");
  if ($sql){echo tanshow("","plug_getinfo.php");}else{echo mysql_error();}
  
}?>

<?php if($rel=='add_info'){
  $names=funstr($_POST["names"]);
  $urls=funstr($_POST["urls"]);
  $cid=funstr($_POST["cid"]);
  $urlintervals=funstr($_POST["urlintervals"]);
  $rules=funstr($_POST["rules"]);
  $urlincludes=funstr($_POST["urlincludes"]);
  $urlprefixs=funstr($_POST["urlprefixs"]);
  $urlces=funstr($_POST["urlces"]);
  $tags=funstr($_POST["tags"]);
  $titles=funstr($_POST["titles"]);
  $mgs=funstr($_POST["mgs"]);
  $bians=funstr($_POST["bians"]);
  $audits=@funstr($_POST["audits"]);
  $users=funstr($_POST["users"]);
  $source=funstr($_POST["source"]);
  
  if($audits==''){$audits=0;}
  $cids=explode(",",$cid);
  
  $sql=query("insert into ".$dbz."getinfo (names,urls,cid,trees,urlintervals,rules,urlincludes,urlprefixs,urlces,tags,titles,mgs,bians,audits,users,source,times)values('$names','$urls','$cids[0]','$cids[1]','$urlintervals','$rules','$urlincludes','$urlprefixs','$urlces','$tags','$titles','$mgs','$bians','$audits','$users','$source','$times')");
  
  if ($sql){echo tanshow("","plug_getinfo.php");}else{echo mysql_error();}
  
}?>

<?php if($rel=='info_info'){
  $id=funstr($_POST["id"]);
  $names=funstr($_POST["names"]);
  $urls=funstr($_POST["urls"]);
  $cid=funstr($_POST["cid"]);
  $urlintervals=funstr($_POST["urlintervals"]);
  $rules=funstr($_POST["rules"]);
  $urlincludes=funstr($_POST["urlincludes"]);
  $urlprefixs=funstr($_POST["urlprefixs"]);
  $urlces=funstr($_POST["urlces"]);
  $tags=funstr($_POST["tags"]);
  $titles=funstr($_POST["titles"]);
  $mgs=funstr($_POST["mgs"]);
  $bians=funstr($_POST["bians"]);
  $audits=@funstr($_POST["audits"]);
  $users=funstr($_POST["users"]);
  $source=funstr($_POST["source"]);
  
  if($audits==''){$audits=0;}
  $cids=explode(",",$cid);
  
  $sql=query("update ".$dbz."getinfo set names='$names',urls='$urls',cid='$cids[0]',trees='$cids[1]',urlintervals='$urlintervals',rules='$rules',urlincludes='$urlincludes',urlprefixs='$urlprefixs',urlces='$urlces',tags='$tags',titles='$titles',mgs='$mgs',bians='$bians',audits='$audits',users='$users',source='$source',times='$times' where id=$id");
  
  if ($sql){echo tanshow("","plug_getinfo.php");}else{echo mysql_error();}
  
}?>

<?php if($rel=='sql'){
$charsets='utf8';
$type=(mysql_get_server_info() > '4.1' ? " ENGINE=MYISAM DEFAULT CHARSET='".$charsets."'" : " TYPE=MYISAM");
$sql=query("DROP TABLE IF EXISTS ".$dbz."getinfo");
	  $sql=query("CREATE TABLE `".$dbz."getinfo` (
           `id` int(3) NOT NULL auto_increment,
  `names` varchar(50) NOT NULL default '',
  `cid` int(3) NOT NULL default '0',
  `trees` varchar(100) NOT NULL default '',
  `urls` varchar(200) NOT NULL default '',
  `urlintervals` varchar(200) NOT NULL default '',
  `rules` varchar(200) NOT NULL default '',
  `urlincludes` varchar(100) NOT NULL default '',
  `urlprefixs` varchar(100) NOT NULL default '',
  `urlces` varchar(200) NOT NULL default '',
  `tags` varchar(200) NOT NULL default '',
  `titles` varchar(200) NOT NULL default '',
  `mgs` varchar(200) NOT NULL default '',
  `bians` varchar(20) NOT NULL default '',
  `audits` int(1) NOT NULL default '0',
  `times` datetime NOT NULL default '0000-00-00 00:00:00',
  `users` varchar(20) NOT NULL default '',
  `source` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`id`)
            ) ".$type."");
			if($sql){echo tanshow("","plug_getinfo.php");}else{echo mysql_error()."<br> <font color=red>创建失败</font>...<br>";}
			
}?>

<?php mysql_close();?>
</body>
</html>