<!-- #include file="include/admin_onlogin.asp" -->
<!-- #InclUDE file="include/jk_pagecute.asp" -->
<!--#include file="include/con_music_conn.asp"-->
<%

tit="MTV管理"  
index_url="music"
call admin_master(0,0)
call admin_header(0,0)

dim askclassid,asksclassid,asknclassid,Specialid,act,founerr,hot,mtvurl,singer
dim name,classid,sclassid,nclassid,sclass,nclass,founderr,yuyan,gongsi,times,pic,intro,gong
askclassid=request.QueryString("askclassid")
asksclassid=request.QueryString("asksclassid")
asknclassid=request.QueryString("asknclassid")
id=request.QueryString("id")
Page=request.QueryString("Page")
act=request("act")
set rs=server.createobject("adodb.recordset")

founerr=false
if act<>"" then
	if trim(Request.Form ("name"))="" then
		founderr=true
		response.write"<scRIPT language=Javascript>alert('MTV名称不能为空');javascript:history.go(-1);</scRIPT>"
	else
		Name=trim(Request.Form ("Name"))
	end if
	if trim(request.form("classid"))="" then
		founderr=true
		response.write"<scRIPT language=Javascript>alert('请选择一级分类');javascript:history.go(-1);</scRIPT>"
	else
		classid=Request.Form("classid")
	end if
	if trim(request.form("sclassid"))="" then
		founderr=true
		response.write"<scRIPT language=Javascript>alert('请选择二级分类');javascript:history.go(-1);</scRIPT>"
	else
		sclassid=trim(Request.Form ("sclassid"))
	end if
	if trim(request.form("nclassid"))="" then
		founderr=true
		response.write"<scRIPT language=Javascript>alert('请选择三级分类');javascript:history.go(-1);</scRIPT>"
	else
		nclassid=trim(Request.Form ("nclassid"))
	end if

	sql="select sclass from mv_sclass where sclassid="&sclassid
	rs.open sql,conn_mv,1,1
	if not rs.EOF then
		sclass=rs("sclass")
	else
		founderr=true
		response.write"<scRIPT language=Javascript>alert('二级栏目选择错误');javascript:history.go(-1);</scRIPT>"
	end if
	rs.close

	sql="select nclass from mv_nclass where nclassid="&nclassid
	rs.open sql,conn_mv,1,1
	if not rs.EOF then
		nclass=rs("nclass")
	else
		founderr=true
		response.write"<scRIPT language=Javascript>alert('三级栏目选择错误');javascript:history.go(-1);</scRIPT>"
	end if
	rs.close
end if

if founderr=true then
	call error()
else
	if act<>"" then
		Name=request("name")
		mtvurl=request("mtvurl")
		singer=request("singer")
		hot=request("hot")

		if trim(Request.Form("Yuyan"))="" then	
			Yuyan="未知"
		else
			Yuyan=request.form("Yuyan")	
		end if

		if trim(Request.Form("Times"))="" then
			Times="2004年"
		else
			Times=request.form("Times")
		end if

		if trim(Request.Form("pic"))="" then
			pic="images/Nophoto.gif"
		else
			pic=request.form("pic")		
		end if

	end if

	if act="edit" and id<>"" then
'修改商品资料
		sql="select * from mv_mtvlist where id="&id 
		rs.open sql,conn,1,3
		rs("name")=trim(name)
		rs("Yuyan")=trim(Yuyan)
		rs("Times")=trim(Times)
		rs("pic")=trim(pic)
		rs("Classid")=Classid
		rs("SClassid")=SClassid
		rs("SClass")=SClass
		rs("Nclassid")=Nclassid
		rs("Nclass")=Nclass
		rs("mtvurl")=trim(mtvurl)
		rs("singer")=trim(singer)
		
		rs.update
		rs.close
'结束修改

	elseif act="add" then
		sql="select * from mv_mtvlist where (id is null)" 
		rs.open sql,conn,1,3
		rs.addnew
		rs("name")=trim(name)
		rs("Yuyan")=trim(Yuyan)
		rs("Times")=trim(Times)
		rs("pic")=trim(pic)
		rs("classid")=classid
		rs("SClass")=SClass
		rs("Sclassid")=Sclassid
		rs("Nclassid")=Nclassid
		rs("Nclass")=Nclass
		rs("mtvurl")=trim(mtvurl)
		rs("singer")=trim(singer)
		rs.update
		rs.close

		conn.close
		set conn=nothing
		response.write"<SCRIPT language=JavaScript>alert('操作成功！');"
		response.write"javascript:history.go(-2);</SCRIPT>"
		Response.End 
	end if
	set rs=nothing
end if


response.write"<scRIPT language=Javascript>alert('操作成功！');"
response.write"javascript:history.go(-2);</scRIPT>"
Response.End

%>