<!--#include file="conn.asp"-->
<%
	
'检查用户访问的权限
call checkuser(5)

strID=request.QueryString("id")
strClass=GetFormVariable("selClass")
strCode=GetFormVariable("txtCode")
strName=GetFormVariable("txtName")
strInfo=GetFormVariable("txtInfo")
strMember=GetFormVariable("rdoMember")
strVote=GetFormVariable("rdoVote")
strLink=GetFormVariable("rdoLink")
strServer=GetFormVariable("txtServer")

if strID="" then
	'检查模板编辑是否已经存在
	strSQL="Select id From templet Where t_code='" & strCode & "'"
	rs.open strSQL,conn,1,1
	if rs.recordcount>0 then
		ShowMsg "已经存在编号为 " & strCode & " 的模板，请改用其他编号！"
	end if
	rs.close
	'添加模板
	strSQL="Insert Into templet(t_type,t_code,t_name,t_intro,t_member,t_vote,t_link,t_server) Values("
	strSQL=strSQL & "" & strClass & ","
	strSQL=strSQL & "'" & strCode & "',"
	strSQL=strSQL & "'" & strName & "',"
	strSQL=strSQL & "'" & strInfo & "',"
	strSQL=strSQL & "" & strMember & ","
	strSQL=strSQL & "" & strVote & ","
	strSQL=strSQL & "" & strLink & ","
	strSQL=strSQL & "'" & strServer & "')"
else
	strID=Cint(strID)
	strSQL="Update templet Set "
	strSQL=strSQL & "t_type=" & strClass & ","
	strSQL=strSQL & "t_code='" & strCode & "',"
	strSQL=strSQL & "t_name='" & strName & "',"
	strSQL=strSQL & "t_intro='" & strInfo & "',"
	strSQL=strSQL & "t_member=" & strMember & ","
	strSQL=strSQL & "t_vote=" & strVote & ","
	strSQL=strSQL & "t_link=" & strLink & ","
	strSQL=strSQL & "t_server='" & strServer & "' Where id=" & strID
end if
'response.Write(strSQL)
conn.execute strSQL,0,1

response.Redirect("Admin_TempList.asp?class=" & strClass)

%>
