当前位置: 代码网 > it编程>编程语言>其他编程 > 如何实现歌曲在线点播?

如何实现歌曲在线点播?

2024年05月18日 其他编程 我要评论
<%dim choose,path,mydb,myset,sql,fs,mp3' 获得用户提交表单(list.htm)选中的曲目对应的id号,并将其赋给字串变量choose. choose=“(

<%
dim choose,path,mydb,myset,sql,fs,mp3
' 获得用户提交表单(list.htm)选中的曲目对应的id,并将其赋给字串变量choose.
choose=
("
for i=3 to request.form.count
choose=choose
request.form(i)+“,"
next
choose=left(choose,len(choose)
1)+“)"
if choose=
()" then
response.redirect(
list.htm")

response.end

' 判断choose变量,如果不包含id,说明list.htm中没有选中任何歌曲,终止程序.
end if
path=
e:\inetpub\wwwroot\temp\"

' 设置文件路径,temp目录的权限设为对internet匿名用户具有read write 权限.
set fs = createobject(
scripting.filesystemobject")
set mp3 = fs.createtextfile(path
+“listen.m3u", true)

' 创建文件对象.
set mydb=server.createobject(
adodb.connection")

' 创建数据库对象.
mydb.open
music"
sql=
select mp3name,url from "dbname&“where id in "choose set myset=tdb.execute(sql)
do while not myset.eof

' 检索数据库,获得曲目信息.
mp3.write(
http://"myset(url")chr(10))
myset.movenext

' 生成点播曲目文件列表.
loop
sql=
update music set click=click1,
this=this
1 where id in "choose
mydb.execute(sql)

' 更新数据库中的当天点播次数和总共点播次数.
set myset=nothing
mydb.close
set mydb=nothing
mp3.close
set mp3=nothing

' 清空.
response.redirect(
listen.m3u")

' 将该文件下传到用户.
response.end
%>

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com