<!--#include file="inc.asp"-->
<!--#include file="check.asp"-->
<%
act=request("act")
ClassID=request("Classid")
founderr=false
if act="del" then
FunDel
elseif act="edit" then
FunEdit
elseif act="add" then
FunAdd
elseif act="SetIsGood" then
FunSetIsGood
else
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
end if
if founderr=true then
call error()
else
Response.write "<script>window.alert('操作成功！');javascript:history.back(1);</script>"
end if

function FunDel
Rem 删除歌曲
sql="delete from musiclist where musicid=" & request("musicid")
conn.execute sql
Rem 删除点歌栏目相关内容
sql="delete from Sendmusic where musicid=" & request("musicid")
conn.execute sql
if err.Number<>0 then
err.clear
errmsg=errmsg+"<br>"+"<li>操作错误！请联系管理员"
founderr=true
end if
end function


function FunAdd
if request.form("name1")="" then 
response.write "<script>alert('请输入歌曲名称!');history.back();</script>"
response.end
end if

Num=request.form("no")
sclass=request.form("sclass") 
nclass=request.form("nclass")
specialname=request.form("specialname")
j=0

set rs=server.createobject("adodb.recordset")
sql="select * from MusicList"
rs.open sql,conn,1,3
for i=1 to Num
MusicName=trim(request.form("Name"&i))
lrc=trim(request.form("lrc"&i))
url=trim(request.form("url"&i))
backurl=trim(request.form("backurl"&i))
hits=trim(request.form("hits"&i))
isgood=trim(request.form("isgood"&i))

if MusicName="" or isnull(MusicName) or Url="" or isnull(Url) then
else
j=j+1
rs.addnew
rs("Name")=MusicName
rs("NClass")=NClass
rs("SClass")=SClass
rs("specialname")=specialname
rs("SClassid")=Request.Form("SClassid")
rs("NClassid")=Request.Form("NClassid")
rs("Specialid")=Request.Form("specialid")
rs("url1")=url
if lcase(backurl)<>".wma" then rs("url2")=backurl
rs("isgood")=isgood
rs("hits")=hits
if lrc<>"" and not isnull(lrc) then
rs("lrc")=lrc
else
rs("lrc")="[ti:"&MusicName&"][ar:"&NClass&"][00:01.50]暂无歌词："&NClass&"-"&MusicName&"[00:26.95]www.0hao.cn[00:52.45]欢迎你的光临"
end if
rs("checklrc")=true
rs.update


end if

next
rs.close
%>

<TABLE border=0 height=200>
<TR>
<TD colSpan=2 height=25>　</TD>
</TR>
</table>
<TABLE class=tableBorder cellSpacing=1 cellPadding=3 align=center border=0 width="400">
<TR>
<TH class=tableHeaderText colSpan=6 height=25>歌曲批量添加成功</TH>
</TR>
<tr>
<td align="center" width="100%" class=forumRowHighlight><p>共添加了 <a href=0hao_song_show.asp?specialid=<%=request.form("specialid")%>><%=j%></a> 首歌曲</p>
</td></tr>
<tr>
<td height="26" align=center><a href="javascript:history.go(-2)">返回</a>&nbsp;<a href="javascript:history.go(-1)">继续添加</a></td>
</tr>
</table>
<%
set rs=nothing
conn.close
set conn=nothing

response.end

end function



function FunEdit
name=trim(request("name"))
if name="" then errmsg=errmsg+"<br>"+"<li>歌曲名不能为空！"
if request.form("url1")="" then
errmsg=errmsg+"<br>"+"<li>试听地址1不能为空！"
call error()
Response.End
end if

set rs=server.createobject("adodb.recordset")
sql="select * from musiclist where musicid="&request("musicid")
rs.open sql,conn,3,3
rs("specialid")=Request.Form("specialid")
rs("specialname")=Request.Form("specialname")
rs("name")=request.form("name")
rs("hits")=request.form("hits")
rs("weekhits")=request.form("weekhits")
rs("wytj")=request.form("wytj")
rs("boxnum")=request.form("boxnum")
rs("url1")=request.form("url1")
rs("url2")=request.form("url2")
rs("isgood")=request.form("isgood")
rs("addtime")=request.form("addtime")
rs("lrc")=replace(request.form("lrc"),"<br>",vbcrlf)
rs.update
rs.close

set rs=nothing

'修改点歌中的资料
set rs=server.createobject("adodb.recordset")
sql = "SELECT * FROM Sendmusic where musicid="&request("musicid")
rs.Open sql,conn, 1, 3
if not rs.eof then
do while not rs.eof
rs("musicName")=request("name")
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
end function

'推荐
function FunSetIsGood
set rs=server.createobject("adodb.recordset")
sql="select IsGood from musiclist where musicid="&request("musicid")
rs.open sql,conn,1,3
if not rs.EOF then
if rs("IsGood")=true then
rs("IsGood")=false
else
rs("IsGood")=true
end if
rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end function
%>