<!--#include file="admin_start.asp"-->

<%
dim id
dim ids
dim n_ids

id=request("id")
ids=request("ids")
ids=replace(ids," ","")
n_ids=""


if not MySys.check.isInteger(id) and request("action")="edit" then
MySys.error.info="请选择您要操作的项目！"
MySys.error.location="back"
MySys.error.err()
end if

select case request("action")
case "delete"

	if ids="" then
		MySys.error.info="请选择你要删除的计数统计！"
		MySys.error.location="back"
		MySys.error.err()
	end if		

	conn.execute("delete from jins_counter_list where counter_id in ("&ids&") ")
	
	MySys.error.info="删除计数统计成功！"
	MySys.error.location="back"
	MySys.error.suc()
	
case else

	if request("action")="add" then
	    sql="select * from jins_counter_list "
	else
	    sql="select * from jins_counter_list where counter_id="&id&" "
	end if
	
	rs.open sql,conn,1,3
	
	'/////////////////////////////////////////////检测
	
	if request("action")="add" then
	    rs.addnew
		MySys.error.info="计数统计添加成功！"
	    MySys.error.location="admin/admin_info_counter_list.asp?order_name=counter_addtime&order_action=desc&s_n=6,sort_id,0&sort_id=0"
	else
		MySys.error.info="计数统计编辑成功！"
	    MySys.error.location="back"
	end if

	if request("action")="edit" and rs.eof then
		MySys.error.info="您选择的计数统计不存在！"
		MySys.error.location="back"
		MySys.error.err()
	end if
	

	if request("counter_name")="" or request("counter_js_out")=""  then 	
		MySys.error.info="请完整填写相关项目！"
		MySys.error.location="back"
		MySys.error.err()
	end if
	
	'/////普通项
	rs("sort_id")=0
	if request("counter_name")<>"" then rs("counter_name")=trim(request("counter_name"))
	if request("counter_open")<>"" then rs("counter_open")=int(request("counter_open"))	
	if request("counter_js_out")<>"" then rs("counter_js_out")=trim(request("counter_js_out"))
	if request("counter_addtime")<>"" then rs("counter_addtime")=trim(request("counter_addtime"))
	
	if instr(1,rs("counter_js_out"),"<script")=0 then rs("counter_js_out")="<script>"&rs("counter_js_out")
	if instr(1,rs("counter_js_out"),"</script>")=0 then rs("counter_js_out")=rs("counter_js_out")&"</script>"
	
	rs.update
	rs.close
	
	MySys.error.suc()

	'/////////////////////////////////////////////
end select
Set fso = nothing

%>
<!--#include file="admin_end.asp"-->
