<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/md5.asp"-->
<!--#include file="../../conn/headpage.asp"-->
 <%
 musicjg=10
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("uflag")<>3 then 
response.write "<script language='javascript'>"
response.write "alert('您还不是诚信会员，没有个人主页功能，相关情况请联系管理员！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
userid=session("id")
sql="select * from snsn_user where username='"&session("user")&"' and id="&session("id")&""
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs("uflag")<>3 then
response.write "<script language='javascript'>"
response.write "alert('您还不是诚信会员，没有个人主页功能，相关情况请联系管理员！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else
if request("action")="gm" then
				if isChkInteger(request("id")) then
id=request("id")
else
response.write "<script language='javascript'>"
response.write "alert('非法操作，正在返回！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
			sql="select * from snsn_music where id="&id&" and uid="&session("id")
			set rs=conn.execute(sql)
		    if not rs.eof then
				response.write "<script language='javascript'>"
                response.write "alert('您已经购买过该音乐了，请返回！');"
                response.write"javascript:history.go(-1)</SCRIPT>"
				response.End()
		    else
		      
		sql="select * from snsn_music where id="&id
         Set musicrs= Server.CreateObject("ADODB.Recordset") 
         musicrs.open sql,conn,1,3
		 if not musicrs.eof then
		 sql="select * from snsn_user where id="&session("id")
                  Set rsjf= Server.CreateObject("ADODB.Recordset") 
                 rsjf.open sql,conn,1,3

                    if rsjf("jifen")<clng(musicjg) then
			        response.write "<script language='javascript'>"
                    response.write "alert('您的积分不够了，请返回！');"
                    response.write"javascript:history.go(-1)</SCRIPT>"
			        response.End()
			        else
			        rsjf("jifen")=rsjf("jifen")-clng(musicjg)
			        rsjf.update
		            end if
					session("jifen")=rsjf("jifen")
				  rsjf.close
                  set rsjf=nothing
		    musicrs.update

		 conn.execute="insert into snsn_music (title,mname,url,uid,px,lx) values('"&musicrs("title")&"','"&musicrs("mname")&"','"&musicrs("url")&"',"&session("id")&",0,0)"
			   response.write "<script language='javascript'>"
                    response.write "alert('购买成功，请返回！');"
                    response.write"javascript:history.go(-1)</SCRIPT>"
			        response.End()
					
					else
								   response.write "<script language='javascript'>"
                    response.write "alert('未找到该音乐，请返回！');"
                    response.write"javascript:history.go(-1)</SCRIPT>"
			        response.End()
		    end if
					  mini.close
          set mini=nothing
			end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交易助手管理操作平台_<%=webname%></title>
<script>
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
<link rel="stylesheet" href="/css.css" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body><!--#include file="../../top.asp"-->
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td width="970"><table width="970"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="10"><img src="/img/m_left.gif" width="10" height="20"></td>
          <td width="950" bgcolor="#FFFFFF"></td>
          <td width="10"><img src="/img/m_right.gif" width="10" height="20"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="188" colspan="3"><table width="950"  border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="1" bgcolor="efefef"></td>
                <td width="200" height="77" valign="top"><!--#include file="../left.asp"--></td>
                <td width="1" bgcolor="efefef"></td>
                <td valign="top">
                    <%
Set rs = Server.CreateObject("ADODB.Recordset")
if request("action")="musicname" then
rs.open "SELECT  * From snsn_music where title='"&nosql(request("musicname"))&"' and lx=1 order by px",conn,1,1
else
rs.open "SELECT  * From snsn_music where lx=1 order by px",conn,1,1
end if
%>
                    <br>
                    <%
	  whichpage=Trim(Request.QueryString("page"))
	  if whichpage="" then
	  page=1
	  else
	  page=whichpage
	  end if
	  if rs.bof and rs.eof then
	  %>
                    <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#BBD7FF">
                      <tr>
                        <td height="25" bgcolor="#FFFFFF"><div align="center">还没有音乐呢，请先<a href="music_edit.asp?action=add">添加音乐</a>！</div></td>
                      </tr>
                    </table>
                    <br>
                    <%else
rs.pagesize=msg_per_page '定义分页记录集每页显示记录数
if not (rs.eof and rs.bof) then
	totalrec=RS.RecordCount'总记录条数
	if rs.recordcount mod msg_per_page=0 then'计算总页数,recordcount:数据的总记录数
		n=rs.recordcount\msg_per_page'n:总页数
	else
		n=rs.recordcount\msg_per_page+1                        
	end if                                                                
	currentpage=request("page")'currentpage:当前页
	If currentpage <> "" then
		currentpage =  cint(currentpage)
		if currentpage < 1 then  
			currentpage = 1
		end if  
		if err.number <> 0 then '错误处理
			err.clear
			currentpage=1
		end if
	else
		currentpage=1
	End if                                                                
	if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then 
		currentPage=1
	end if
	rs.absolutepage=currentpage'absolutepage：设置指针指向某页开头
	rowcount=rs.pagesize'pagesize：设置每一页的数据记录数
end if
do while not rs.eof and rowcount > 0	  %>
                    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#BBD7FF">
                      <tr bgcolor="#e8f4ff">
                        <td width="15%" height="22" align="center">歌曲名称：</td>
                        <td width="35%">&nbsp;<%=rs("title")%></td>
                        <td width="15%" align="center">加入时间：</td>
                        <td width="35%">&nbsp;<%=Rs("dateandtime")%></td>
                      </tr>
                      <tr bgcolor="#FFFFFF">
                        <td height="23" align="center">歌手大名：</td>
                        <td>&nbsp;<%=rs("mname")%></td>
                        <td align="center">功能按钮：</td>
                        <td bgcolor="#FFFFFF">&nbsp;<a href="?action=gm&id=<%=rs("id")%>">我要购买该音乐</a> (银两：<%=musicjg%>) <a href="javascript:;"  onClick="javascript:window.open('music_st.asp?id=<%=rs("id")%>','muq','width=300,height=70')">试听</a> </td>
                      </tr>
                    </table>
                    <table width="90%" height="10"  border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td></td>
                      </tr>
                    </table>
                    <%
rowcount=rowcount-1
rs.movenext
loop
	  %>
                    <br>
                    <table width=90% height="22" border=0 align=center cellpadding=0 cellspacing=1 bgcolor="#BBD7FF">
                      <tr>
                        <td align=center bgcolor="#FFFFFF"> <%call listPages()%>
                        </td>
                      </tr>
                    </table>
                   
                    <%end if%>
                    <br>
                    <table width="90%" border="0" cellspacing="1" cellpadding="4" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#BBD7FF">
                      <tr>
                        <td bgcolor="#FFFFFF"><div align="center">注：本站音乐均为网友自行上传，如涉及到音乐版权问题将由网友自行负责，本站不承担任何责任！</div></td>
                      </tr>
                    </table>
</td>
              </tr>
          </table></td>
        </tr>
    </table></td>
    <td valign="top"><img src="/img/index_img.jpg" width="10"></td>
  </tr>
</table>
</td>
</tr>
</table>
<!--#include file="../../end.asp"-->
<%end if%>
</body>
</html>
<%
if Request("action")="del" then
id=nosql(Request.QueryString("id"))
sql="select * from snsn_music where id="&id
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
rs.delete
response.Redirect("music.asp")
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>