www.gusucode.com > 维六酷博客管理系统 1.1源码程序 > master/multimedia.asp
<!--#include file="check.asp"--> <!-- #include file="../inc/conn.asp" --> <!-- #include file="../inc/function.asp" --> <!--#include file="../inc/asppage.asp"--> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>multimedia</title> <link href="css.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> function del(id) { var ok; ok=confirm("删除后不可恢复!您确定要删除此文件吗?"); if (ok==true) { window.location="multimedia.asp?action=del&id="+id; } else {} } function show(n) { if (n==0) { document.getElementById("lyic").style.display="none"; } if (n==1) { document.getElementById("lyic").style.display="block"; } } </script> </head> <body topmargin="10" background="images/bg1024.gif"> <table width="98%" align=center cellpadding="2" cellspacing="1"> <tr><td> <a href="multimedia.asp?cid=1">音乐</a> <a href="multimedia.asp?cid=2">视频</a> <a href="multimedia.asp?cid=3">FLASH</a> <a href="multimedia.asp?action=add"><strong>上传多媒体文件</strong></a> <a href="multimediaList.asp" class=red>生成音乐播放列表</a> </td></tr></table> <% action=RequestSafeStr("action") Select Case action Case "add" Call add() Case "save" Call save() Case "edit" Call edit() Case "editsave" Call editSave() Case "del" Call del() Case "top" Call top() Case else Call show() End Select %> <% Sub save() title=RequestFormStr("title") singer=RequestFormStr("singer") lyrics=RequestFormStr("lyrics") categoryid=RequestFormNum("categoryid") url=RequestFormStr("url") If title="" Then Call MessageBox("请输入名称!","") Response.End End If If url="" Then Call MessageBox("请上传文件!","") Response.End End If set rs=Server.CreateObject("ADODB.Recordset") sql="select * from multimedia" rs.open sql,conn,1,3 rs.addnew rs("title")=title rs("singer")=singer rs("lyrics")=lyrics rs("categoryid")=categoryid rs("url")=url rs.update rs.close Call MessageBox("添加文件成功!","multimedia.asp") End Sub Sub editSave() id=RequestFormNum("id") If id<>0 then title=RequestFormStr("title") singer=RequestFormStr("singer") lyrics=RequestFormStr("lyrics") categoryid=RequestFormNum("categoryid") url=RequestFormStr("url") If title="" Then Call MessageBox("请输入名称!","") Response.End End If If url="" Then Call MessageBox("请上传文件!","") Response.End End If set rs=Server.CreateObject("ADODB.Recordset") sql="select * from multimedia Where id="& id &"" rs.open sql,conn,2,3 If Not rs.eof then rs("title")=title rs("singer")=singer rs("lyrics")=lyrics rs("categoryid")=categoryid rs("url")=url rs.update End If rs.close Call MessageBox("修改多媒体文件成功!","multimedia.asp") End If End Sub 'del Sub del() Dim url,urlsmall id=RequestQueryNum("id") If id<>0 Then Set rs=conn.Execute("Select url from multimedia Where id="& id &"") If Not rs.eof Then If InStr(rs("url"),"UpFile/multimedia/")<>0 then url="../"& rs("url") Call delFile(url) End If Set rs=nothing conn.Execute("delete From multimedia Where id="& id &"") End If Call MessageBox("删除成功!","multimedia.asp") End If End Sub 'top Sub top() id=RequestQueryNum("id") intTop=RequestQueryNum("top") If id<>0 Then conn.Execute("Update multimedia set [top]="& intTop &",toptime=Now() Where id="& id &"") If intTop=1 Then strMsg="操作成功!" Else strMsg="操作成功!" End If Call MessageBox(strMsg,"multimedia.asp?cid=1") End If End Sub Sub show() cid=RequestQueryNum("CID") If cid<>0 Then sql="Select * From multimedia Where categoryid="& cid &" Order by id desc" Else sql="Select * From multimedia Order by id desc" End If Set mypage=new xdownpage '创建对象 mypage.getconn=conn '得到数据库连接 mypage.getsql=sql mypage.pagesize=20 '设置每一页的记录条数据为5条 set rs=mypage.getrs() '返回Recordset %> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <tr> <th height="25" colspan="5">文件管理</th> </tr> <tr> <td class=Forumrow width="100">编号</td> <td class=Forumrow>名称</td> <td class=Forumrow width="40" align="center">类型</td> <td class=Forumrow width="220">上传时间</td> <td class=Forumrow align="center" width="200">操作</td> </tr> <% for i=1 to mypage.pagesize If rs.eof Then Exit for End If cid=rs("categoryid") If cid=1 Then str="音乐" ElseIf cid=2 Then str="视频" ElseIf cid=3 Then str="Flash" End If %> <tr> <td class=Forumrow><%=rs("id")%></td> <td class=Forumrow align="left"> <a href="../play.asp?id=<%=rs("id")%>" target="_blank"><%=rs("title")%></a></td> <td class=Forumrow><%=str%></td> <td class=Forumrow width="150"><%=rs("posttime")%></td> <td class=Forumrow align="center" width="200"> <% If rs("categoryid")=1 then If rs("top")=0 then%> <a href="?action=top&id=<%=rs("id")%>&top=1">首页播放</a> <%else%> <a href="?action=top&id=<%=rs("id")%>&top=0" class=red>取消首页播放</a> <%End If End If%> <a href="?action=edit&id=<%=rs("id")%>">编辑</a> <a href="javascript:del(<%=rs("id")%>)">删除</a></td> </tr> <% rs.MoveNext Next %> <tr align="center"><td colspan="5" class=Forumrow><%mypage.showpage() %></td></tr> </table> <% End Sub Function checked(id,cid) If id=cid Then Response.Write "checked=""true""" checked=True Else checked=false End If End Function Sub add() Dim show cid=RequestQueryNum("cid") If cid=1 Or cid=0 Then show=" " Else show="none" End If %> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form name="add" method="post" action="multimedia.asp"> <input type="hidden" name="action" value="save"> <tr> <th height="25" colspan="2">上传多媒体文件</th> </tr> <tr> <td height="25" align="right" class=Forumrow>选择多媒体文件类型:</td> <td align="left" class=Forumrow> <input type="radio" name="categoryid" value="1" <%checked 0,cid : checked 1,cid%> onclick="show(1)" >音乐 <input type="radio" name="categoryid" value="2" <%checked 2 ,cid%> onclick="show(0)" >视频 <input type="radio" name="categoryid" value="3" <%checked 3,cid%> onclick="show(0)" >Flash </td> </tr> <tr> <td width="15%" height="25" align="right" class=Forumrow>名称:</td> <td align="left" class=Forumrow> <input name="title" type="text" value="" size="25" maxlength="40" style="width:304"> </td> </tr> <tr> <td width="15%" height="25" align="right" class=Forumrow>作者/歌手:</td> <td align="left" class=Forumrow> <input name="singer" type="text" value="" size="25" maxlength="40" style="width:100"> </td> </tr> <tr> <td height="25" align="right" class=Forumrow>上传:</td> <td align="left" class=Forumrow style="padding-left:15px;"> <input name="url" type="text" size="30" style="width:304">(可以直接输入网络文件地址.)<br /> <iframe border=0 frameborder=0 framespacing=0 height=22 width="306" marginheight=0 marginwidth=0 name=new_date noresize scrolling=no src="uploadForm2.asp?upFolder=multimedia&inputName=url" vspale="0"></iframe> (最大上传:<%=mediaSize%>KB)<br> 如果文件太大>2MB,请通过FTP上传到您的空间,再把多媒体的网址输入到上边的文本框内. </td> </tr> <tr id="lyic" style="display:<%=show%>;"> <td height="25" align="right" class=Forumrow>歌词:</td> <td align="left" class=Forumrow> <textarea name="lyrics" rows="5" cols="50"></textarea> </td> </tr> <tr> <td class=Forumrow></td> <td height="30" class=Forumrow> <input type="submit" name="Submit" value="添加" class="input1"> <input type="reset" name="Submit" class="input1"></td> </tr> </form> </table> <% End Sub Sub edit() Dim show id=RequestQueryNum("id") Set rs=conn.Execute("Select * From multimedia Where id="& id &"") If Not rs.eof Then If rs("categoryid")=1 Then show="" Else show="none" End If %> <table width="98%" border="0" class="tableBorder" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form name="add" method="post" action="multimedia.asp"> <input type="hidden" name="action" value="editsave"> <input type="hidden" name="id" value="<%=id%>"> <tr> <th height="25" colspan="2">编辑多媒体文件</th> </tr> <tr> <td height="25" align="right" class=Forumrow width="150">选择多媒体文件类型:</td> <td align="left" class=Forumrow> <input type="radio" name="categoryid" value="1" <%Call setchecked(1,rs("categoryid"))%> onclick="show(1)">音乐 <input type="radio" name="categoryid" value="2" <%Call setchecked(2,rs("categoryid"))%> onclick="show(0)">视频 <input type="radio" name="categoryid" value="3" <%Call setchecked(3,rs("categoryid"))%> onclick="show(0)">Flash </td> </tr> <tr> <td height="25" align="right" class=Forumrow>名称:</td> <td align="left" class=Forumrow> <input name="title" type="text" value="<%=rs("title")%>" size="25" maxlength="40" style="width:305"> </td> </tr> <tr> <td height="25" align="right" class=Forumrow>作者/歌手:</td> <td align="left" class=Forumrow> <input name="singer" type="text" value="<%=rs("singer")%>" size="25" maxlength="40" style="width:100"> </td> </tr> <tr> <td height="25" align="right" class=Forumrow>上传:</td> <td align="left" class=Forumrow style="padding-left:15px;"> <input name="url" type="text" size="30" value="<%=rs("url")%>" style="width:305">(可以直接输入网络文件地址.)<br /> <iframe border=0 frameborder=0 framespacing=0 height=22 width="310" marginheight=0 marginwidth=0 name=new_date noresize scrolling=no src="uploadForm2.asp?upFolder=multimedia&inputName=url" vspale="0"></iframe> (最大上传:<%=mediaSize%>KB)<br> 如果文件太大>2MB,请通过FTP上传到您的空间,再把多媒体的网址输入到上边的文本框内. </td> </tr> <tr id="lyic" style="display:<%=show%>"> <td height="25" align="right" class=Forumrow>歌词:</td> <td align="left" class=Forumrow> <textarea name="lyrics" rows="5" cols="50"><%=rs("lyrics")%></textarea> </td> </tr> <tr> <td class=Forumrow></td> <td height="30" class=Forumrow> <input type="submit" name="Submit" value="修改" class="input1"> <input type="reset" name="reset" class="input1"></td> </tr> </form> </table> <% End If End Sub %> </body> </html>