<!--#include file="../conn.asp" -->
<%
if session("username")="" then
response.Redirect("merr.asp?action=err")
response.End()
else
username=session("username")
userid=session("userid")
end if
%>
<%
set rs8=server.createobject("adodb.recordset")
sql8="select * from Music where userid="&userid&" order by hit desc"
rs8.open sql8,conn,1,3
amount=rs8.recordcount
%>
<%
if Trim(Request.QueryString("action"))="addmu" then
singer=Trim(Request.Form("singer"))
musicname=Trim(Request.Form("musicname"))
file=Trim(Request.Form("file"))
uid=Trim(Request.Form("userid"))
if musicname="" then
%>
<script language='Javascript'>alert("请您提交有效的数据!");history.back();</script>
<%
response.end
end if
Set r = Server.CreateObject("ADODB.Recordset")
  sql="select money from diaryuser where userid="&uid
   r.open sql,conn,3,2
if r("money")<=2 then
%>
<script language='Javascript'>alert("你的金币不够，不能添加歌曲！");history.back();</script>
<%
response.end
end if
set rs9=server.CreateObject("adodb.recordset")
sql9="select * from Music"
rs9.open sql9,conn,1,3
rs9.addnew
rs9("singer")=singer
rs9("musicname")=musicname
rs9("musicfile")=file
rs9("userid")=uid
rs9.update
rs9.close
set rs9=nothing
   r("money")=r("money")-3
   r.update
    r.close
response.Redirect("mmusic.asp")
end if
%>
<%
if Trim(Request.QueryString("action"))="del" then
delid=Trim(Request.QueryString("delid"))
sql7="select * from Music where id="&delid
set rs7=server.CreateObject("adodb.recordset")
rs7.open sql7,conn,1,3
userid1=rs7("userid")
if session("userid")=userid1 then
else
%>
<script language='Javascript'>alert("您无权删除其他用户的信息!");history.back();</script>
<%
response.end
end if

rs7.delete
rs7.close
set rs7=nothing
response.Redirect("mmusic.asp")
end if
%>
<%
if Trim(Request.QueryString("action"))="top" then
topid=Trim(Request.QueryString("topid"))
sql6="select * from Music where id="&topid
set rs6=server.CreateObject("adodb.recordset")
rs6.open sql6,conn,3,2
userid2=rs6("userid")
if session("userid")=userid2 then
else
%>
<script language='Javascript'>alert("您无权更改其他用户的信息!");history.back();</script>
<%
response.end
end if
rs6("hit")=1
rs6.update
rs6.close
set rs6=nothing
response.Redirect("mmusic.asp")
end if
%>
<%
if Trim(Request.QueryString("action"))="dow" then
dowid=Trim(Request.QueryString("dowid"))
sql5="select * from Music where id="&dowid
set rs5=server.CreateObject("adodb.recordset")
rs5.open sql5,conn,3,2
userid2=rs5("userid")
if session("userid")=userid2 then
else
%>
<script language='Javascript'>alert("您无权更改其他用户的信息!");history.back();</script>
<%
response.end
end if
rs5("hit")=0
rs5.update
rs5.close
set rs5=nothing
response.Redirect("mmusic.asp")
end if
%>
<%
if Trim(Request.QueryString("action"))="true" then
useridd=Trim(Request.QueryString("useridd"))
sql5="select userid,musicyesno from diaryuser where userid="&useridd&""
set rs5=server.CreateObject("adodb.recordset")
rs5.open sql5,conn,3,2
userid2=rs5("userid")
if session("userid")=userid2 then
else
%>
<script language='Javascript'>alert("您无权更改其他用户的信息!");history.back();</script>
<%
response.end
end if
rs5("musicyesno")="true"
rs5.update
rs5.close
set rs5=nothing
response.Redirect("mmusic.asp")
end if
%>
<%
if Trim(Request.QueryString("action"))="false" then
useridd=Trim(Request.QueryString("useridd"))
sql5="select userid,musicyesno from diaryuser where userid="&useridd&""
set rs5=server.CreateObject("adodb.recordset")
rs5.open sql5,conn,3,2
userid2=rs5("userid")
if session("userid")=userid2 then
else
%>
<script language='Javascript'>alert("您无权更改其他用户的信息!");history.back();</script>
<%
response.end
end if
rs5("musicyesno")="false"
rs5.update
rs5.close
set rs5=nothing
response.Redirect("mmusic.asp")
end if
%>
	<%
userid=session("userid")
set rs=server.CreateObject("adodb.Recordset")
sql2="select * from diaryuser where userid="&userid&""
Rs.Open Sql2,conn,1,1
IF Not Rs.Eof Then
money=rs("money")
fenmian=rs("fenmian")
shuyu=rs("shuyu")
name=rs("username")
bookname=rs("bookname")
gongao=rs("gongao")
Musicyesno=rs("musicyesno")
rs.close
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="../diary/css.css" rel="stylesheet" type="text/css">
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" style="background-color=transparent">
<table width="284" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="370" width="284" align="right">
      <table border="0" width="278" id="table8" cellspacing="0" cellpadding="0" height="370">
        <tr> 
          <td height="19">　</td>
        </tr>
        <tr> 
          <td valign="top"> 
            <form language="javascript"  name="regform" method="post" action="mmusic.asp?action=addmu">
					
              <table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">
                <tr> 
                  <td width="71"> 
                    <p align="center"><b><font color="#FF0000">音乐增加：</font></b>
                  </td>
                  <td width="188" height="15"><font color="#FF0000"> 只能加mid、mp3与WMA的3种格式.</font></td>
                </tr>
                <tr> 
                  <td width="71"> 
                    <p align="right"><b><font color="#00ACF0">歌手姓名：</font></b>
                  </td>
                  <td width="188" height="15"> 
                    <input name="singer" type="text" class="input01"  size="20"　title="singer">
                  </td>
                </tr>
                <tr> 
                  <td width="71"> 
                    <p align="right"><b><font color="#00ACF0">歌曲名称：</font></b>
                  </td>
                  <td width="188" height="15"> 
                    <input name="musicname" type="text" class="input01"  size="20" title="music">
                  </td>
                </tr>
                <tr> 
                  <td width="71"> 
                    <p align="right"><b><font color="#00ACF0">歌曲地址：</font></b>
                  </td>
                  <td width="188" height="15"> 
                    <input name="file" type="text" class="input01" id="file" size="30">
                  </td>
                </tr>
                <tr> 
                  <td width="71"> 
                    <input name="userid" type="hidden" id="userid" value="<%=userid%>">
                  </td>
                  <td width="188" height="15"> 
                    <input name="Submit" type="submit" class="button1" value=" 增 加 ">
                    &nbsp; 
                    <input name="Submit1" type="reset" class="button1" value=" 重 设 ">
                  </td>
                </tr>
                <tr> 
                  <td colspan="2" background="diary/linebg2.gif" height="1"><img border="0" src="diary/linebg2.gif" width="4" height="1"></td>
                </tr>
              </table>
              <table border="0" width="278" id="table8" cellspacing="0" cellpadding="0" height="100%">
                <tr> 
                  <td height="14" colspan="5"></td>
                </tr>
                <tr> 
                  <td height="24" width="61"> 
                    <p align="center">&nbsp; 
                  </td>
                  <td height="24" width="61"> 
                    
                  </td>
                  <td height="24" width="90"> 
                    <p><font color="#00ACF0"> 是否自动播放：</font>
                  </td>
                  <%if Musicyesno="false" then%>
                  <td height="24" width="36"> <a href="mmusic.asp?action=true&useridd=<%=session("userid")%>"> 
                    <img border="0" src="<%=alltubg%>mm/YES.gif" width="29" height="11"></a></td>
                  <td height="24" width="24"> <img border="0" src="<%=alltubg%>mm/NO_N.gif" width="24" height="12"></td>
                  <%else%>
                  <td height="24" width="29"> <img border="0" src="<%=alltubg%>mm/YES_n.gif" width="29" height="11"></td>
                  <td height="24" width="24"> <a href="mmusic.asp?action=false&useridd=<%=session("userid")%>"> 
                    <img border="0" src="<%=alltubg%>mm/NO.gif" width="24" height="12"></a></td>
                  <%end if%>
                </tr>
                <tr> 
                  <td colspan="5"> <img border="0" src="diary/linebg2.gif" width="4" height="1"></td>
                </tr>
                <tr> 
                  <td colspan="5" valign="top"> 
                    <table border="0" width="100%" id="table9" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" id="table10">
                            <tr> 
                              <td align="center" style="font-size: 9pt; font-family: Verdana; color: #000000; letter-spacing: 1pt; word-break: break-all" background="img/bg_line.gif">
                                <%
Rs8.Open Sql2,conn,3,1
IF Rs8.Eof and Rs8.bof Then
response.Write("<br><font color=FF6600>本账号还没有任何歌曲！</font><br><br><br><br><br><br>")
else


Rs8.pagesize=8
maxpage=Rs8.pagecount
page=clng(request("page"))


if page="" or page=0 then
   page=1
end if
if page>maxpage then
    page=maxpage
end if

Rs8.absolutepage = page

do while not Rs8.eof
%>
                                <table width="272" border="0" cellpadding="0" cellspacing="0"  id="table11">
                                  <tr bordercolor="DDE7AB">
                                    <td width="2"></td>
                                    <td width="18"></td>
                                    <td width="125"><font color="#51300C"> <%=rs8("musicname")%></font></td>
                                    <td width="70"><font color="#00ACF0"><%=rs8("singer")%></font></td>
                                    <td width="26">
                                      <%if rs8("hit")=0 then%>
                                      <font color="#800000"><a href="mmusic.asp?action=top&topid=<%=rs8("id")%>">固顶</a></font>
                                      <%else%>
                                      <font color="#800000"><a href="mmusic.asp?action=dow&dowid=<%=rs8("id")%>"><font color="#FF6600">卸顶</font></a></font>
                                      <%end if%>
                                    </td>
                                    <td width="30"> 
                                      <p align="right"> <font color="#800000"><a href="mmusic.asp?action=del&delid=<%=rs8("id")%>"> 
                                        <font color="#800080">删除</font></a></font>
                                    </td>
                                    <td width="1"> <font color="#1242CC"> <img border="0" src="img/20-1.gif" width="1" height="20"></font></td>
                                  </tr>
                                </table>
                                <%
n=n+1
Rs8.movenext
if n>=Rs8.pagesize then exit do    
loop
%>
                                <br>
                                <table width="98%" border="0" cellspacing="0" cellpadding="0" id="table13">
                                  <tr> 
                                    <td> 
                                      <p align="right"><font color="#51300C">目前有</font>：<font color="#FF0000"><%=amount%></font><font color="#703F15">条歌 
                                        <%
if cstr(page)=1 then
Response.Write("<font color=#808080>首页&nbsp;上页&nbsp;</font>")
else
if page>1 and page=maxpage then%>
                                        <a href="mmusic.asp?page=1"> <font color="#5690BE">首页</font></a> 
                                        <a href="mmusic.asp?page=<%=page-1%>"> 
                                        <font color="#5690BE">上页</font></a> 
                                        <%end if%>
                                        <% if page<>1 and page<>maxpage then%>
                                        <a href="mmusic.asp?page=1"> <font color="#5690BE">首页</font></a><a href="mmusic.asp?page=<%=page-1%>"> 
                                        <font color="#5690BE">上页</font></a> 
                                        <%end if
end if


if cstr(page)=cstr(Rs8.pagecount) then%>
                                        <font color="#808080">下页</font> <font color="#808080">尾页</font> 
                                        <%else%>
                                        <%
			if cstr(page)=1 and cstr(page)<>cstr(Rs8.pagecount) and cstr(Rs8.pagecount)<>0 then%>
                                        <a href="mmusic.asp?page=<%=page+1%>" > 
                                        <font color="#5690BE">下页</font></a> <a href="mmusic.asp?page=<%=maxpage%>"> 
                                        <font color="#5690BE">尾页</font></a> 
                                        <%end if%>
                                        <%
			if cstr(page)<>1 and cstr(page)<>cstr(Rs8.pagecount) and cstr(Rs8.pagecount)<>0 then%>
                                        <a href="mmusic.asp?page=<%=page+1%>" > 
                                        <font color="#5690BE">下页</font></a> <a href="mmusic.asp?page=<%=maxpage%>"> 
                                        <font color="#5690BE">尾页</font></a> 
                                        <%end if%>
                                        <%end if%>
                                        <font color="#5690BE"> :<%=page%>/<%=maxpage%>&nbsp; 
                                        &nbsp; </font></font>
                                    </td>
                                  </tr>
                                </table>
                                <%
Rs8.Close
Set Rs8=Nothing
End IF
else%>
                                <table width="98%" border="0" cellspacing="0" cellpadding="0" id="table14">
                                  <tr> 
                                    <td align="center" style="font-size: 9pt; font-family: Verdana; color: #000000; letter-spacing: 1pt; word-break: break-all">　</td>
                                  </tr>
                                </table>
                                <%
end if
%>
                              </td>
                            </tr>
                          </table></td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
        <tr> 
          <td background="diary/linebg2.gif" height="1"> <img border="0" src="diary/linebg2.gif" width="4" height="1"></td>
        </tr>
        <tr valign="top"> 
          <td>&nbsp; </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>



