asp如何实现歌曲在线点播?

时间:2010-05-19 21:32:00 

好了,下面我们看看如何在服务器上生成.m3u文件并下传到客户端的:

<%
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=click+1,
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
%>

标签:mp3,asp,点歌
0
投稿

猜你喜欢

  • Pycharm不同版本镜像源添加方法

    2023-08-24 15:59:43
  • 得到字符串真实长度和取固定长度的字符串函数

    2008-10-06 13:12:00
  • 详谈tensorflow gfile文件的用法

    2021-01-30 20:10:23
  • Pytorch:Conv2d卷积前后尺寸详解

    2021-01-18 23:36:54
  • javascript 实现子父窗体互相传值的简单实例

    2023-08-09 09:52:52
  • Python中的XML库4Suite Server的介绍

    2023-08-12 01:26:41
  • 详解Python手写数字识别模型的构建与使用

    2023-10-21 18:34:12
  • 使用python实现将视频中的音频分离出来

    2021-10-20 21:26:07
  • python输出第n个默尼森数的实现示例

    2022-08-12 21:07:25
  • JS实现TITLE悬停长久显示效果完整示例

    2024-04-16 09:54:00
  • Extjs显示从数据库取出时间转换JSON后的出现问题

    2024-01-18 12:52:13
  • 基于python的七种经典排序算法(推荐)

    2023-06-16 18:21:43
  • Burpsuite模块之Burpsuite Intruder模块详解

    2023-11-24 05:31:24
  • 如何用C代码给Python写扩展库(Cython)

    2023-06-08 17:06:32
  • python matplotlib绘图,修改坐标轴刻度为文字的实例

    2023-09-29 12:27:57
  • 基于wxpython实现的windows GUI程序实例

    2022-07-03 21:33:01
  • 最新Python idle下载、安装与使用教程图文详解

    2022-08-27 12:33:15
  • 基于Python3.6中的OpenCV实现图片色彩空间的转换

    2022-05-20 14:03:13
  • python 日志模块logging的使用场景及示例

    2023-01-10 16:39:57
  • vue-seamless-scroll无缝滚动组件使用方法详解

    2024-04-29 13:07:51
  • asp之家 网络编程 m.aspxhome.com