<?php
if(!defined('MOD'))  die("access die");
$rules = intval($_GET['rules']);
$works = $_GET['works'];
$newname = $_POST['name'];
$channelid = intval( $_GET['channelid'] );
$sqls = "SELECT * FROM ".TABLEPRE."collect_rule WHERE `id`='$rules' ";
$row_rules = qdb::QueryFirst( $sqls );
if(empty($row_rules)) qbase::showmsg("没有找到相关数据");

if ("copy" == $works ){
	if(empty($newname)) qbase::showmsg("需要填写新采集器名称");
	foreach($row_rules as &$val){
		$val = addslashes($val);
	}
	$row_rules['name'] = $newname;
	$row_rules['cid'] = intval($_POST['cid'] );
	unset($row_rules['id']);
	$sql = qbase::createSql("".TABLEPRE."collect_rule", $row_rules, "insert");
	qdb::Query( $sql );

	$turn_text = '复制成功！！';
	$turn_url = "system.php?sys=collect&work=rules_show&channelid=$channelid";
	qbase::showmsg( "$turn_text", "default", "$turn_url" );
}
@extract( $row_rules );
include qbase::template( $path . '/' .  "copy_rules" );
?>
