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
投稿

猜你喜欢

  • 防止网站内容被人小偷和采集的ASP代码

    2007-10-02 13:04:00
  • ASP向SQL语句传递参数方法

    2008-04-13 06:07:00
  • ASP生成数字相加求和的BMP图片验证码

    2011-04-14 10:48:00
  • asp 获取url函数小结

    2011-03-17 10:38:00
  • 详细讲解MySQL数据库对文件操作的封装

    2008-12-17 16:08:00
  • Oracle 常用的SQL语句

    2009-08-02 07:09:00
  • 大家都对vertical-align的各说各话

    2008-06-19 12:11:00
  • 收集的ORACLE函数大全

    2010-07-16 12:58:00
  • window.location.hash的应用及浏览器的支持测试

    2009-07-07 11:52:00
  • 用server.transfer隐藏网页真实地址

    2007-12-04 13:02:00
  • 轻松接触MaxDB和MySQL之间的协同性

    2008-11-27 16:25:00
  • SQL Server日志清除的两种方法教程简介

    2008-05-04 20:59:00
  • 如何提高ASP的效率?

    2010-06-07 20:52:00
  • 如何实现html表格里隔行换色

    2007-10-19 13:42:00
  • 如何设计具可用性的网页表单?

    2010-03-20 21:57:00
  • ASP存储过程应用全接触

    2007-08-18 14:28:00
  • 解决在Dreamweaver中不支持中文文件名的方法

    2010-09-02 12:35:00
  • conn.execute(sql)后面加(0)和不加的区别

    2009-06-24 11:13:00
  • 交互设计实用指南系列(8)—深广度平衡

    2010-02-01 12:59:00
  • escape解决AJAX中文乱码的简单方法

    2008-10-23 14:32:00
  • asp之家 网络编程 m.aspxhome.com