📄 manage.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="head.asp"-->
<%
If Session(CookieName & "_flag")="" Then
response.Redirect("login.asp")
end if
'//////////////////////////////
Select Case Request("action")
Case "manage"
Call guide()
Call manage()
Call Footer()
Case "save_manage"
Call guide()
Call save_manage()
Call Footer()
Case "class_manage"
Call guide()
Call class_manage()
Call Footer()
Case "save_class_manage"
Call guide()
Call save_class_manage()
Call Footer()
Case "config"
Call guide()
Call config()
Call Footer()
Case "save_config"
Call guide()
Call save_config()
Call Footer()
Case "make_xml"
Call guide()
Call make_xml()
Call Footer()
Case "show"
Call guide()
Call show()
Call Footer()
Case "check_music_name"
Call check_music_name()
Case "make_lrc"
Call make_lrc()
Call Footer()
Case Else
Call guide()
Call main()
Call Footer()
End Select
If Errmsg<>"" Then cenfun_error()
sub guide()
%>
<table border="0" cellspacing="1" cellpadding="5" align=center class="tableBorder">
<tr>
<th>CenFun Music Player 音乐管理中心</th>
</tr>
<tr>
<td class="cmsRow"><a href="?">音乐列表</a> | <a href="?action=manage">添加音乐</a> | <a href="?action=class_manage">专辑管理</a> | <a href="?action=config">播放器配置</a> | <a href="?action=make_xml" title="所有的操作完成,最后请务必在这里生成xml文件方能更新信息!"><font color="#ff0000">生成XML文件</font></a> | <a href="?action=show">查看效果</a></td>
</tr>
</table>
<br>
<%
end sub
sub main()
dim num
dim cfclass_list
sql="select classid,classname from cmp_class order by sn"
set rs=conn.execute(sql)
if rs.bof or rs.eof then
Errmsg=Errmsg&"<li>至少需要一个专辑,请先<a href=""?action=class_manage""><strong>添加</strong></a>"
cenfun_error()
exit sub
else
cfclass_list=rs.GetRows()
end if
rs.close
set rs=nothing
dim classid,classname
if request("classid")<>"" and IsNumeric(request("classid")) then
classid=request("classid")
end if
dim selectm,selectkey,classsql
dim lrc_select,pic_select
selectm=trim(request("selectm"))
selectkey=trim(request(trim("selectkey")))
if selectkey="" then
selectm=""
end if
lrc_select=request("lrc_select")
pic_select=request("pic_select")
%>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1">
<form name="form_search" method="post" action="?classid=<%=classid%>&page=<%=request("page")%>">
<tr>
<td align="center"><table border="0" align="center" cellpadding="2" cellspacing="0">
<tr align="center">
<td><select name='JumpClass' id="JumpClass" onChange="if(this.options[this.selectedIndex].value!='0'){location='?classId='+this.options[this.selectedIndex].value;}">
<option value='' selected>所有专辑</option>
<%
for num=0 to UBound(cfclass_list,2)
response.write "<option value='"&cfclass_list(0,num)&"' "
if trim(cfclass_list(0,num))=classid then
response.write "selected"
end if
response.write ">"&cfclass_list(1,num)&"</option>"
next
%>
</select>
</td>
<td><strong>关键字</strong></td>
<td><input name="selectkey" type="text" size="15" id="selectkey" onDblClick="this.value=''" value="<%=selectkey%>"></td>
<td><select name="selectm" id="select">
<option value="title">按名称</option>
<option value="url" <%if selectm="url" then%>selected="selected"<%end if%>>按地址</option>
<option value="content" <%if selectm="content" then%>selected="selected"<%end if%>>按内容</option>
</select>
</td>
<td><select name="lrc_select">
<option value="">歌词不限</option>
<option value="0" <%if lrc_select="0" then%>selected="selected"<%end if%>>无歌词</option>
<option value="1" <%if lrc_select="1" then%>selected="selected"<%end if%>>有歌词</option>
</select>
</td>
<td><select name="pic_select">
<option value="">图片不限</option>
<option value="0" <%if pic_select="0" then%>selected="selected"<%end if%>>无图片</option>
<option value="1" <%if pic_select="1" then%>selected="selected"<%end if%>>有图片</option>
</select>
</td>
<td><input type="submit" name="Submit2" value="搜 索"></td>
</tr>
</table></td>
</tr>
</form>
</table>
<table border="0" cellspacing="1" cellpadding="2" align=center class="tableBorder">
<form name="form_main" method="post" action="?classid=<%=classid%>&page=<%=request("page")%>">
<tr>
<th height="25" colspan="9" align="center"><strong>内容列表</strong></th>
</tr>
<tr align="center" class="cmsRow">
<td nowrap><input name="chkAll" type="checkbox" id="chkAll" onClick="CheckAll(this.form)" value="checkbox" /></td>
<td nowrap>序号</td>
<td nowrap>名称</td>
<td>专辑</td>
<td nowrap>介绍</td>
<td nowrap="nowrap">Url/Lrc/Pic</td>
<td nowrap>更新时间</td>
</tr>
<%
'############################删除选项#######################################
dim selectid
selectid=request("selectid")
if request("del")="删除所选" and selectid<>"" then
conn.execute("delete from cmp_list where id in ("&selectid&")")
response.redirect Request.ServerVariables("HTTP_REFERER")
end if
'##############################专辑#########################################
if classid<>"" and IsNumeric(classid) then
classsql="and classid="&classid
end if
'#########################自动批量排序######################################
dim sum,autosn
sum=1
autosn=Replace(trim(Request("autosn")),"'","")
if autosn<>"" then
set rs=conn.execute("select id from cmp_list order by "&autosn&" desc")
do while not rs.eof
conn.execute("update cmp_list set sn="&sum&" where id="&rs("id"))
sum=sum+1
rs.movenext
loop
rs.close
set rs=nothing
end if
'############################排序选项#######################################
if request("sn")="排序所选" and selectid<>"" then
'response.Write ""
dim selectidlist
selectidlist=split(selectid,", ")
'response.Write ""
for i=0 to ubound(selectidlist)
if IsNumeric(request.form("sn"&selectidlist(i))) then
conn.execute("update cmp_list set sn="&request.form("sn"&selectidlist(i))&" where id="&int(selectidlist(i))&"")
end if
next
'response.redirect Request.ServerVariables("HTTP_REFERER")
'response.Redirect "?classid="&request("classid")
end if
'#############################分页显示######################################
dim CurrentPage,totalnumber,page_count,MaxPerPage,Pagenumber
MaxPerPage=12 '每页显示数目
CurrentPage=request("page")
if CurrentPage="" or not IsNumeric(CurrentPage) then
CurrentPage=1
else
CurrentPage=clng(CurrentPage)
if err then
CurrentPage=1
err.clear
end if
end if
'########## 查询过滤 ############
dim sql1
sql1=" order by sn,lasttime desc "
select case selectm
case ""
sql=" title like '%"&selectkey&"%' "&classsql&" "
case "title"
sql=" title like '%"&selectkey&"%' "&classsql&" "
case "url"
sql=" url like '%"&selectkey&"%' "&classsql&" "
case "content"
sql=" content like '%"&selectkey&"%' "&classsql&" "
case else
sql=" 1=1 "&classsql&" "
end select
if lrc_select="0" then
sql=sql&" and lrc='' "
elseif lrc_select="1" then
sql=sql&" and lrc<>'' "
end if
if pic_select="0" then
sql=sql&" and pic='' "
elseif pic_select="1" then
sql=sql&" and pic<>'' "
end if
Set Rs=conn.execute("Select count(id) From cmp_list Where "&sql&" ")
totalnumber=Rs(0)
Rs.close:Set Rs=Nothing
set rs=conn.execute("select id,classid,title,url,lrc,content,pic,lasttime,sn from cmp_list where "&sql&" "&sql1&" ")
'##########分页############
if err.number<>0 or (rs.eof And rs.bof) then
Response.Write "<tr><td colspan=8 align=center class=cmsRow><font color=#ff0000>没有找到相关信息!</font></td></tr>"
else
if totalnumber mod MaxPerPage=0 then
Pagenumber= totalnumber \ MaxPerPage
else
Pagenumber= totalnumber \ MaxPerPage+1
end if
RS.MoveFirst
if CurrentPage > Pagenumber then CurrentPage = Pagenumber
if CurrentPage<1 then CurrentPage=1
RS.Move (CurrentPage-1) * MaxPerPage
page_count=0
do while not rs.eof and page_count < Clng(MaxPerPage)
%>
<tr class="cmsRow" onMouseOver="this.style.backgroundColor='#E4E4E4'" onMouseOut="this.style.backgroundColor=''">
<td align="center"><input name="selectid" type="checkbox" id="selectid" value="<%=rs("id")%>"></td>
<td align="center"><input type="text" name="sn<%=rs("id")%>" id="sn<%=rs("id")%>" size="3" maxlength="6" value="<%=rs("sn")%>"></td>
<td nowrap="nowrap"><a href="?action=manage&manage=edit&classid=<%=classid%>&id=<%=rs("id")%>" title="点击修改"><%=rs("title")%></a></td>
<td align="center" nowrap><%
classname="未知分类"
for num=0 to UBound(cfclass_list,2)
if trim(cfclass_list(0,num))=trim(rs("classid")) then
classname="<a href=?classid="&cfclass_list(0,num)&">"&cfclass_list(1,num)&"</a>"
end if
next
response.write classname
%></td>
<td><%=rs("content")%></td>
<td align="center"><a href="<%=rs("url")%>" target="_blank" title="点击直接打开音乐地址"><img src="images/mp3.gif" width="16" height="16" border="0" /></a>
<%if rs("lrc")<>"" then%>
<img src="images/lrc.gif" width="16" height="16" border="0" />
<%else response.write("<img src=""images/null.gif"" width=""16"" height=""16"" border=""0"" /> ") end if%>
<%if rs("pic")<>"" then%>
<img src="images/jpg.gif" width="16" height="16" border="0" />
<%else response.write("<img src=""images/null.gif"" width=""16"" height=""16"" border=""0"" /> ") end if%></td>
<td align="center" nowrap><%=FormatDateTime(rs("lasttime"),2)%></td>
</tr>
<%
page_count=page_count+1
rs.movenext
loop
end if
rs.close
set rs=nothing
'########################################end############################################
%>
<tr>
<td height="30" colspan="9" align="center" class="cmsRow"> 对选项进行操作:
<input type="submit" name="sn" value="排序所选">
<select name="autosn" id="select" onChange="{if(confirm('确定对以上所有内容重新排序吗?')){submit();}return false;}">
<option value="">自动排序</option>
<option value="addtime">按添加时间</option>
<option value="lasttime">按更新时间</option>
<option value="id">按数据ID</option>
<option value="title">按名称</option>
</select>
<input type="submit" name="del" value="删除所选" onClick="return test();">
<font color="#ff0000">注意:未选择则操作无效</font> </td>
</tr>
<tr align="center">
<td class="cmsRow" colspan="9"><table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr align="right">
<td><%showpage "zh",1,"?selectm="&selectm&"&selectkey="&selectkey&"&lrc_select="&lrc_select&"&pic_select="&pic_select&"&classid="&request("classid")&"",totalnumber,MaxPerPage,true,true,"首",CurrentPage%></td>
</tr>
</table></td>
</tr>
</form>
</table>
<%
end sub
sub manage()
dim manage,pagetitle
dim id,classid,title,url,lrc,content,pic,t,fg,a,c,u,scene,addtime,lasttime,sn
if request("manage")="edit" then
'----------------------------------------------
manage="edit"
pagetitle="修改音乐"
set rs=conn.execute("select id,classid,title,url,lrc,content,pic,t,fg,a,c,u,scene,addtime,lasttime,sn from cmp_list where id="&trim(request.QueryString("id"))&" ")
id=rs("id")
classid=rs("classid")
title=rs("title")
url=rs("url")
lrc=rs("lrc")
content=rs("content")
pic=rs("pic")
t=rs("t")
fg=rs("fg")
a=rs("a")
c=rs("c")
u=rs("u")
scene=rs("scene")
addtime=rs("addtime")
lasttime=SystemTime
sn=rs("sn")
rs.close
set rs=nothing
'----------------------------------------------
else
'----------------------------------------------
manage="add"
pagetitle="添加音乐"
classid=0
title=""
url=""
lrc=""
content=""
pic=""
t=""
fg=""
a=""
c=""
u=""
scene=""
addtime=SystemTime
lasttime=SystemTime
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -